diff options
author | Paul Ackersviller <packersv@users.sourceforge.net> | 2007-11-04 20:39:46 +0000 |
---|---|---|
committer | Paul Ackersviller <packersv@users.sourceforge.net> | 2007-11-04 20:39:46 +0000 |
commit | 68741bbe5009586738198f92ee148f6228bc04aa (patch) | |
tree | b5dfe88c96793281b90407b161fd71d797172897 /Functions | |
parent | aa0ac67c139d69e7629334545c4ad94de7057954 (diff) | |
download | zsh-68741bbe5009586738198f92ee148f6228bc04aa.tar.gz zsh-68741bbe5009586738198f92ee148f6228bc04aa.tar.xz zsh-68741bbe5009586738198f92ee148f6228bc04aa.zip |
Merge of users/9604: enhance run-help to strip quotes and 22874: run-help unquoting wasn't consistent.
Diffstat (limited to 'Functions')
-rw-r--r-- | Functions/Misc/run-help | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/Functions/Misc/run-help b/Functions/Misc/run-help index a6755e72f..bae321890 100644 --- a/Functions/Misc/run-help +++ b/Functions/Misc/run-help @@ -33,15 +33,25 @@ then fi # No zsh help; use "whence" to figure out where else we might look -local what places newline=' +local what places noalias newline=' ' integer i=0 didman=0 places=( "${(@f)$(builtin whence -va $1)}" ) +if [[ $places = *"not found"* && $1 != ${(Q)1} ]]; then + # Different when unquoted, so try stripping quotes. + places=( "${(@f)$(builtin whence -va ${(Q)1})}" ) + if (( ${#places} )); then + set -- "${(Q)@}" + fi + # Quotation is significant to aliases, so suppress lookup. + noalias=1 +fi while ((i++ < $#places)) do what=$places[$i] + [[ -n $noalias && $what = *" is an alias "* ]] && continue builtin print -r $what case $what in (*( is an alias)*) @@ -71,8 +81,11 @@ do (*( is hashed to *)) man ${what[(w)-1]:t} ;; + (*( is a reserved word)) + man zshmisc + ;; (*) - ((! didman++)) && man $1 + ((! didman++)) && man $@ ;; esac if ((i < $#places && ! didman)) |