diff --git a/helper.zsh b/helper.zsh index 1df159a..cf28d07 100644 --- a/helper.zsh +++ b/helper.zsh @@ -19,7 +19,7 @@ TRAP_SIGNALS=( # Adds a function to a list to be called when a trap is triggered. function add-zsh-trap() { if (( $# < 2 )); then - print "Usage: $0 type function" + print "usage: $0 type function" return 1 fi diff --git a/init.zsh b/init.zsh index 20d38ab..46545ae 100644 --- a/init.zsh +++ b/init.zsh @@ -3,7 +3,7 @@ # Check for the minimum supported version. min_zsh_version='4.3.10' if ! autoload -Uz is-at-least || ! is-at-least "$min_zsh_version"; then - print "omz: The minimum supported Zsh version is $min_zsh_version." + print "omz: too old shell version detected, minimum required: $min_zsh_version" fi unset min_zsh_version diff --git a/plugins/archive/functions/extract b/plugins/archive/functions/extract index 2271fab..40fe5cf 100644 --- a/plugins/archive/functions/extract +++ b/plugins/archive/functions/extract @@ -4,12 +4,14 @@ local file_name local extract_dir if (( $# == 0 )); then - print "Usage: extract [-option] [file ...]" - print - print "Options:" - print " -r, --remove Remove archive." - print - print "Report bugs to ." + cat >&2 <. +EOF fi remove_archive=1 @@ -20,7 +22,7 @@ fi while (( $# > 0 )); do if [[ ! -f "$1" ]]; then - print "extract: '$1' is not a valid file" 1>&2 + print "$0: file not valid: $1" >&2 shift continue fi @@ -56,7 +58,7 @@ while (( $# > 0 )); do cd .. ;; (*) - print "extract: '$1' cannot be extracted" 1>&2 + print "$0: cannot extract: $1" >&2 success=1 ;; esac diff --git a/plugins/archive/functions/ls-archive b/plugins/archive/functions/ls-archive index 589b245..2e8cdc5 100644 --- a/plugins/archive/functions/ls-archive +++ b/plugins/archive/functions/ls-archive @@ -1,12 +1,14 @@ local verbose if (( $# == 0 )); then - print "Usage: extract [-option] [file ...]" - print - print "Options:" - print " -v, --verbose Verbose archive listing." - print - print "Report bugs to ." + cat >&2 <. +EOF fi if [[ "$1" == "-v" ]] || [[ "$1" == "--verbose" ]]; then @@ -16,7 +18,7 @@ fi while (( $# > 0 )); do if [[ ! -f "$1" ]]; then - print "extract: '$1' is not a valid file" 1>&2 + print "$0: file not valid: $1" >&2 shift continue fi @@ -35,7 +37,7 @@ while (( $# > 0 )); do (*.rar) unrar ${${verbose:+v}:-l} "$1" ;; (*.7z) 7za l "$1" ;; (*) - print "ls-archive: '$1' cannot be listed" 1>&2 + print "$0: cannot list: $1" >&2 success=1 ;; esac diff --git a/plugins/git/functions/git-hub b/plugins/git/functions/git-hub index e9d18ae..2ef84ee 100644 --- a/plugins/git/functions/git-hub +++ b/plugins/git/functions/git-hub @@ -30,11 +30,11 @@ if [[ -n "$url" ]]; then "$BROWSER" "$url" return 0 else - print "fatal: Browser not set or set to a non-existent browser." >&2 + print "$0: browser not set or set to a non-existent browser" >&2 return 1 fi else - print "fatal: Not a Git repository or origin remote not set." >&2 + print "$0: not a Git repository or remote origin not set" >&2 return 1 fi diff --git a/plugins/git/functions/git-info b/plugins/git/functions/git-info index e3069c8..0d2f931 100644 --- a/plugins/git/functions/git-info +++ b/plugins/git/functions/git-info @@ -64,7 +64,7 @@ function _git-info-abort() { return 1 fi - cat > /dev/stderr <&2 <&2 fi return 0 fi diff --git a/plugins/history-substring-search/history-substring-search.zsh b/plugins/history-substring-search/history-substring-search.zsh index 8577130..980c74f 100644 --- a/plugins/history-substring-search/history-substring-search.zsh +++ b/plugins/history-substring-search/history-substring-search.zsh @@ -149,7 +149,7 @@ if [[ $+functions[_zsh_highlight] -eq 0 ]]; then { # Load Zsh module zsh/zleparameter, needed to override user defined widgets. zmodload zsh/zleparameter 2>/dev/null || { - print 'zsh-syntax-highlighting: failed loading zsh/zleparameter.' >&2 + print 'history-substring-search: failed loading: zsh/zleparameter' >&2 return 1 } @@ -176,7 +176,7 @@ if [[ $+functions[_zsh_highlight] -eq 0 ]]; then zle -N $cur_widget _zsh_highlight_widget_$cur_widget";; # Default: unhandled case. - *) print "zsh-syntax-highlighting: unhandled ZLE widget '$cur_widget'" >&2 ;; + *) print "history-substring-search: unhandled ZLE widget: $cur_widget" >&2 ;; esac done } diff --git a/plugins/perl/functions/pgs b/plugins/perl/functions/pgs index 99a375c..bff559e 100644 --- a/plugins/perl/functions/pgs +++ b/plugins/perl/functions/pgs @@ -1,6 +1,6 @@ # Perl Global Substitution if (( $# < 2 )); then - print "Usage: $0 find replace [file ...]" >&2 + print "usage: $0 find replace [file ...]" >&2 return 1 fi diff --git a/plugins/perl/functions/prep b/plugins/perl/functions/prep index ef9118e..4832629 100644 --- a/plugins/perl/functions/prep +++ b/plugins/perl/functions/prep @@ -1,6 +1,6 @@ # Perl grep since 'grep -P' is terrible. if (( $# < 1 )) ; then - print "Usage: $0 pattern [file ...]" >&2 + print "usage: $0 pattern [file ...]" >&2 return 1 fi diff --git a/plugins/wakeonlan/functions/wake b/plugins/wakeonlan/functions/wake index 83410c7..c4cba48 100644 --- a/plugins/wakeonlan/functions/wake +++ b/plugins/wakeonlan/functions/wake @@ -1,11 +1,11 @@ local config_file="$HOME/.wakeonlan/$1" if [[ ! -f "$config_file" ]]; then - print "$0: $1: There is no such device file." >&2 + print "$0: no such device file: $1" >&2 return 1 fi if (( ! $+commands[wakeonlan] )); then - print "$0: Can't find wakeonlan. Is it installed?" >&2 + print "$0: command not found: wakeonlan" >&2 return 1 fi