Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove-echo #612

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ source "$HOME/.bashrc"
set | grep -aE "^OSH"

if [[ "$OSH_THEME" == "font" ]]; then
echo "Installation succeeded"
printf -- "Installation succeeded"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
printf -- "Installation succeeded"
printf '%s\n' "Installation succeeded"

Newline is missing

else
echo "Installation failed, \$OSH_THEME is not set to 'font'"
printf -- "Installation failed, \$OSH_THEME is not set to 'font'"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
printf -- "Installation failed, \$OSH_THEME is not set to 'font'"
printf '%s\n' "Installation failed, \$OSH_THEME is not set to 'font'"

Newline is missing.

exit 1
fi
2 changes: 1 addition & 1 deletion aliases/general.aliases.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Landau (2013-07-02) [1] and later modified:
| `mkdir` | `mkdir -pv` | Recursive `mkdir` if the target does not exist (option `-v` is added if supported) |
| `mv` | `mv -iv` | `mv` with confirmation on overwriting (option `-v` is added if supported) |
| `nano` | `nano -W` | (option `-W` is added if supported) |
| `path` | `echo -e ${PATH//:/\\n}` | Echo all executable Paths |
| `path` | `printf -- ${PATH//:/\\n}` | Echo all executable Paths |
| `show_options` | `shopt` | display bash options settings |
| `src` | `source ~/.bashrc` | Reload `.bashrc` file |
| `wget` | `wget -c` | Preferred `wget` implementation (resume download) |
4 changes: 2 additions & 2 deletions aliases/general.aliases.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ alias ll='ls -lAFh' # Preferred 'ls' implementation
alias less='less -FSRXc' # Preferred 'less' implementation
alias wget='wget -c' # Preferred 'wget' implementation (resume download)
alias c='clear' # c: Clear terminal display
alias path='echo -e ${PATH//:/\\n}' # path: Echo all executable Paths
alias path='printf -- ${PATH//:/\\n}' # path: Echo all executable Paths
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't cover the case where PATH contains % and other \.

alias show_options='shopt' # Show_options: display bash options settings
alias fix_stty='stty sane' # fix_stty: Restore terminal settings when screwed up
alias fix_term='echo -e "\033c"' # fix_term: Reset the conosle. Similar to the reset command
alias fix_term='printf "\033c"' # fix_term: Reset the conosle. Similar to the reset command
alias cic='bind "set completion-ignore-case on"' # cic: Make tab-completion case-insensitive
alias src='source ~/.bashrc' # src: Reload .bashrc file
2 changes: 1 addition & 1 deletion completions/conda.completion.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ elif _omb_util_binary_exists register-python-argcomplete3; then
elif _omb_util_binary_exists register-python-argcomplete2; then
eval "$(register-python-argcomplete2 conda)"
else
echo "Please install argcomplete to use conda completion" >&2
_omb_util_print "Please install argcomplete to use conda completion" >&2
fi
8 changes: 4 additions & 4 deletions completions/fallback/docker-compose.bash
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The files under completions/fallback are taken from the upstream. These should be kept the same as the upstream as much as possible, so we wouldn't change them on our side.

Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ function __docker_compose_q {
function __docker_compose_to_alternatives {
local parts=( $1 )
local IFS='|'
echo "${parts[*]}"
_omb_util_print "${parts[*]}"
}

# Transforms a multiline list of options into an extglob pattern
# suitable for use in case statements.
function __docker_compose_to_extglob {
local extglob=$( __docker_compose_to_alternatives "$1" )
echo "@($extglob)"
_omb_util_print "@($extglob)"
}

# Determines whether the option passed as the first argument exist on
Expand Down Expand Up @@ -81,7 +81,7 @@ function __docker_compose_map_key_of_current_option {

[ "${words[$glob_pos]}" = "=" ] && ((glob_pos--)) # --option=key=value syntax

[[ ${words[$glob_pos]} == @($glob) ]] && echo "$key"
[[ ${words[$glob_pos]} == @($glob) ]] && _omb_util_print "$key"
}

# suppress trailing whitespace
Expand Down Expand Up @@ -282,7 +282,7 @@ function _docker_compose_images {
function _docker_compose_kill {
case "$prev" in
-s)
COMPREPLY=( $( compgen -W "SIGHUP SIGINT SIGKILL SIGUSR1 SIGUSR2" -- "$(echo $cur | tr '[:lower:]' '[:upper:]')" ) )
COMPREPLY=( $( compgen -W "SIGHUP SIGINT SIGKILL SIGUSR1 SIGUSR2" -- "$(_omb_util_print $cur | tr '[:lower:]' '[:upper:]')" ) )
return
;;
esac
Expand Down
22 changes: 11 additions & 11 deletions completions/fallback/docker.bash
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is also taken from the upstream.

Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ function __docker_contexts {
esac
done
__docker_q context ls -q
echo "${add[@]}"
_omb_util_print "${add[@]}"
}

function __docker_complete_contexts {
Expand Down Expand Up @@ -387,7 +387,7 @@ function __docker_plugins_bundled {
for del in "${remove[@]}" ; do
plugins=(${plugins[@]/$del/})
done
echo "${plugins[@]}" "${add[@]}"
_omb_util_print "${plugins[@]} ${add[@]}"
}

# __docker_complete_plugins_bundled applies completion of plugins based on the current
Expand Down Expand Up @@ -535,7 +535,7 @@ function __docker_nodes {
esac
done

echo "$(__docker_q node ls --format "$format" "$@")" "${add[@]}"
_omb_util_print "$(__docker_q node ls --format "$format" "$@") ${add[@]}"
}

# __docker_complete_nodes applies completion of nodes based on the current
Expand Down Expand Up @@ -664,7 +664,7 @@ function __docker_pos_first_nonflag {
(( counter++ ))
done

echo "$counter"
_omb_util_print "$counter"
}

# __docker_map_key_of_current_option returns `key` if we are currently completing the
Expand All @@ -689,7 +689,7 @@ function __docker_map_key_of_current_option {

[ "${words[$glob_pos]}" = "=" ] && ((glob_pos--)) # --option=key=value syntax

[[ ${words[$glob_pos]} == @($glob) ]] && echo "$key"
[[ ${words[$glob_pos]} == @($glob) ]] && _omb_util_print "$key"
}

# __docker_value_of_option returns the value of the first option matching `option_glob`.
Expand All @@ -703,7 +703,7 @@ function __docker_value_of_option {
while [ "$counter" -lt "$cword" ]; do
case ${words[$counter]} in
$option_extglob )
echo "${words[$counter + 1]}"
_omb_util_print "${words[$counter + 1]}"
break
;;
esac
Expand All @@ -717,14 +717,14 @@ function __docker_value_of_option {
function __docker_to_alternatives {
local parts=( $1 )
local IFS='|'
echo "${parts[*]}"
_omb_util_print "${parts[*]}"
}

# __docker_to_extglob transforms a multiline list of options into an extglob pattern
# suitable for use in case statements.
function __docker_to_extglob {
local extglob=$( __docker_to_alternatives "$1" )
echo "@($extglob)"
_omb_util_print "@($extglob)"
}

# __docker_subcommands processes subcommands
Expand Down Expand Up @@ -1103,7 +1103,7 @@ function __docker_complete_signals {
SIGUSR1
SIGUSR2
)
COMPREPLY=( $( compgen -W "${signals[*]} ${signals[*]#SIG}" -- "$( echo "$cur" | tr '[:lower:]' '[:upper:]')" ) )
COMPREPLY=( $( compgen -W "${signals[*]} ${signals[*]#SIG}" -- "$( _omb_util_print "$cur" | tr '[:lower:]' '[:upper:]')" ) )
}

function __docker_complete_ulimits {
Expand Down Expand Up @@ -1147,7 +1147,7 @@ function __docker_complete_user_group {

function __docker_plugins_path {
local docker_plugins_path=$(docker info --format '{{range .ClientInfo.Plugins}}{{.Path}}:{{end}}')
echo "${docker_plugins_path//:/ }"
_omb_util_print "${docker_plugins_path//:/ }"
}

function __docker_complete_plugin {
Expand Down Expand Up @@ -2655,7 +2655,7 @@ function _docker_daemon {
return
;;
--storage-driver|-s)
COMPREPLY=( $( compgen -W "btrfs overlay2 vfs zfs" -- "$(echo "$cur" | tr '[:upper:]' '[:lower:]')" ) )
COMPREPLY=( $( compgen -W "btrfs overlay2 vfs zfs" -- "$(_omb_util_print "$cur" | tr '[:upper:]' '[:lower:]')" ) )
return
;;
--storage-opt)
Expand Down
2 changes: 1 addition & 1 deletion completions/git_flow.completion.sh
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ __git_flow_list_remote_features ()

__git_flow_feature_prefix ()
{
_omb_prompt_git config gitflow.prefix.feature 2> /dev/null || echo "feature/"
_omb_prompt_git config gitflow.prefix.feature 2> /dev/null || _omb_util_print "feature/"
}

__git_flow_release ()
Expand Down
4 changes: 2 additions & 2 deletions completions/projects.completion.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ function _pj {

compopt -o filenames

local -r mark_dirs=$(_rl_enabled mark-directories && echo y)
local -r mark_symdirs=$(_rl_enabled mark-symlinked-directories && echo y)
local -r mark_dirs=$(_rl_enabled mark-directories && _omb_util_print y)
local -r mark_symdirs=$(_rl_enabled mark-symlinked-directories && _omb_util_print y)

for i in ${PROJECT_PATHS//:/$'\n'}; do
# create an array of matched subdirs
Expand Down
16 changes: 8 additions & 8 deletions completions/svn.completion.sh
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is also taken from the upstream project. Please don't change this file. This is the third time I have written "do not change svn.completion.sh"...

Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ function _svn_read_hashfile()
}
read -r -n $len val ; read
if [[ $key = $tkey ]] ; then
echo "$val"
_omb_util_print "$val"
return
fi
done
Expand All @@ -77,7 +77,7 @@ function _svn_grcut()
old_IFS="$IFS"
IFS=$'\n'
while read -r line ; do
[[ ! $re || $line == $re ]] && echo "${line/????????/}"
[[ ! $re || $line == $re ]] && _omb_util_print "${line/????????/}"
done
IFS="$old_IFS"
}
Expand All @@ -89,7 +89,7 @@ function _svn_info()
local what=$1 line=
LANG=C LC_MESSAGES=C svn info --non-interactive 2> /dev/null | \
while read line ; do
[[ $line == *"$what: "* ]] && echo ${line#*: }
[[ $line == *"$what: "* ]] && _omb_util_print ${line#*: }
done
}

Expand All @@ -104,14 +104,14 @@ function _svn_lls()
for f in "$@" ; do
# could try to check in .svn/entries? hmmm...
if [[ $opt == @(dir|all) && -d "$f" ]] ; then
echo "$f/"
_omb_util_print "$f/"
elif [[ $opt == @(file|all) ]] ; then
# split f in directory/file names
local dn= fn="$f"
[[ "$f" == */* ]] && dn=${f%\/*}/ fn=${f##*\/}
# ??? this does not work for just added files, because they
# do not have a content reference yet...
[ -f "${dn}.svn/text-base/${fn}.svn-base" ] && echo "$f"
[ -f "${dn}.svn/text-base/${fn}.svn-base" ] && _omb_util_print "$f"
fi
done
}
Expand Down Expand Up @@ -604,7 +604,7 @@ _svn()
[[ $beep ]] &&
{
# 'no known completion'. hummm.
echo -en "\a"
_omb_util_put "\a"
COMPREPLY=( '' )
}
return 0
Expand Down Expand Up @@ -748,7 +748,7 @@ _svn()
then
# some way to tell 'no completion at all'... is there a better one?
# Do not say 'file completion' here.
echo -en "\a"
_omb_util_put "\a"
COMPREPLY=( '' )
return 0
fi
Expand Down Expand Up @@ -845,7 +845,7 @@ _svn()
[[ "${COMPREPLY[*]}" ]] || COMPREPLY=( '' )
elif [[ ! $fallback ]] ; then
# this suggests no completion...
echo -en "\a"
_omb_util_put "\a"
COMPREPLY=( '' )
fi
fi
Expand Down
16 changes: 8 additions & 8 deletions lib/cli.bash
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,28 @@
_omb_module_require lib:utils

function _omb_cmd_help {
echo 'Not yet implemented'
_omb_util_print 'Not yet implemented'
}
function _omb_cmd_changelog {
echo 'Not yet implemented'
_omb_util_print 'Not yet implemented'
}
function _omb_cmd_plugin {
echo 'Not yet implemented'
_omb_util_print 'Not yet implemented'
}
function _omb_cmd_pull {
echo 'Not yet implemented'
_omb_util_print 'Not yet implemented'
}
function _omb_cmd_reload {
echo 'Not yet implemented'
_omb_util_print 'Not yet implemented'
}
function _omb_cmd_theme {
echo 'Not yet implemented'
_omb_util_print 'Not yet implemented'
}
function _omb_cmd_update {
echo 'Not yet implemented'
_omb_util_print 'Not yet implemented'
}
function _omb_cmd_version {
echo 'Not yet implemented'
_omb_util_print 'Not yet implemented'
}

function omb {
Expand Down
12 changes: 6 additions & 6 deletions lib/mo.sh
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is also taken from the upstream.

Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ function mo {
# shellcheck disable=SC1090
. "$f2source"
else
echo "No such file: $f2source" >&2
_omb_util_print "No such file: $f2source" >&2
exit 1
fi
;;
Expand Down Expand Up @@ -495,7 +495,7 @@ function _moLoadFile {
# a dot to the content to preserve all newlines.
# TODO: remove cat and replace with read loop?

content=$(cat -- "$2"; echo '.')
content=$(cat -- "$2"; _omb_util_print '.')
len=$((${#content} - 1))
content=${content:0:$len} # Remove last dot

Expand Down Expand Up @@ -651,7 +651,7 @@ function _moParse {
_moSplit moContent "$moContent" '{{' '}}'
done

echo -n "${moContent[0]}"
_omb_util_put "${moContent[0]}"
}


Expand All @@ -675,12 +675,12 @@ function _moPartial {

if _moIsStandalone moStandalone "$2" "$4" "$5"; then
moStandalone=( $moStandalone )
echo -n "${2:0:${moStandalone[0]}}"
_omb_util_put "${2:0:${moStandalone[0]}}"
moIndent=${2:${moStandalone[0]}}
moContent=${4:${moStandalone[1]}}
else
moIndent=""
echo -n "$2"
_omb_util_put "$2"
moContent=$4
fi

Expand All @@ -695,7 +695,7 @@ function _moPartial {

# Fix bash handling of subshells
# The extra dot is removed in _moIndentLines
echo -n "${moPartial}."
_omb_util_put "${moPartial}."
)"
_moParse "$moPartial" "$6" true
)
Expand Down
Loading
Loading