summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Pennock <pdpennock@users.sourceforge.net>2013-08-07 03:50:14 -0400
committerPhil Pennock <pdpennock@users.sourceforge.net>2013-08-07 04:11:56 -0400
commit180c4c049c60c963378da8f9582937eb1682870e (patch)
treea925ce18e9bf0f8244268842cece8e1b718b995c
parent9ebf22b34b5e8d4b8bd147a038458d82735d9d2e (diff)
downloadzsh-180c4c049c60c963378da8f9582937eb1682870e.tar.gz
zsh-180c4c049c60c963378da8f9582937eb1682870e.zip
31634: run-help compat with alias to noglob/nocorrect
Given `alias fetch='noglob fetch'`, without this change `run-help fetch` recurses to invoke itself on the noglob command, bringing up the help for noglob. Similarly for nocorrect. Thus the user would have to quit out of the pager, then avoid quitting out of the loop, so that they can go into the second iteration and see the help for the second instance found by `whence -a`, which happens to be the target of the alias. With common pagers, that's thus 'q', 'not-q'. Somewhat frustrating. Without this change, `alias foo='noglob bar'` where `foo` is not otherwise a command would _never_ show the help for `bar`, since it only showed the help for `noglob` and there was no second line of whence output to trigger the second pass. With this change, aliases to `noglob|nocorrect` of a command somewhat ignore the presence of that precommand modifier; if a command is aliased to `noglob $itself`, then the result is that the first line of whence output is shown, no pager is used, the user can immediately see a prompt to continue and press something other-than-q to see the help for the command. If given `alias foo='noglob bar'` then `run-help foo` will immediately show the help for bar. This behaviour was chosen to be consistent with the existing alias support, but just working better with the precommand modifier.
-rw-r--r--ChangeLog5
-rw-r--r--Functions/Misc/run-help4
2 files changed, 9 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index b6ff9fcef..5d99bfb2b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-08-07 Phil Pennock <pdpennock@users.sourceforge.net>
+
+ * 31634: Functions/Misc/run-help: run-help compat with alias to
+ noglob/nocorrect
+
2013-08-05 Peter Stephenson <p.w.stephenson@ntlworld.com>
* 31631: configure.ac, Src/builtin.c: use cygwin_conv_path in
diff --git a/Functions/Misc/run-help b/Functions/Misc/run-help
index 6a9abb3cf..c817b67d6 100644
--- a/Functions/Misc/run-help
+++ b/Functions/Misc/run-help
@@ -56,6 +56,10 @@ do
[[ -n $noalias && $what = *" is an alias "* ]] && continue
builtin print -r $what
case $what in
+ (*( is an alias for (noglob|nocorrect))*)
+ [[ ${what[(w)7]:t} != ${what[(w)1]} ]] &&
+ run_help_orig_cmd=${what[(w)1]} run-help ${what[(w)7]:t}
+ ;;
(*( is an alias)*)
[[ ${what[(w)6]:t} != ${what[(w)1]} ]] &&
run_help_orig_cmd=${what[(w)1]} run-help ${what[(w)6]:t}