summaryrefslogtreecommitdiff
path: root/Functions/Misc/run-help
diff options
context:
space:
mode:
authorAxel Beckert <abe@deuxchevaux.org>2022-04-11 00:17:48 +0200
committerAxel Beckert <abe@deuxchevaux.org>2022-04-11 00:17:48 +0200
commitb09f4483416c54c1782824633dfabaf2ec0265b6 (patch)
tree304bc82642862525ae680c7fbaa249663b10ad57 /Functions/Misc/run-help
parent12eb3e5356f2fc3351eed58ef1cef1b8fb83b504 (diff)
parent6e55c920503071e917619b8cb1a188cd35d772db (diff)
downloadzsh-b09f4483416c54c1782824633dfabaf2ec0265b6.tar.gz
zsh-b09f4483416c54c1782824633dfabaf2ec0265b6.zip
New upstream version 5.8.1.2-test
Diffstat (limited to 'Functions/Misc/run-help')
-rw-r--r--Functions/Misc/run-help15
1 files changed, 9 insertions, 6 deletions
diff --git a/Functions/Misc/run-help b/Functions/Misc/run-help
index e351dd6a6..d52c1b032 100644
--- a/Functions/Misc/run-help
+++ b/Functions/Misc/run-help
@@ -101,12 +101,15 @@ do
builtin getln cmd_args
builtin print -z "$cmd_args"
cmd_args=( ${(z)cmd_args} )
- # Discard environment assignments, etc.
- while [[ $cmd_args[1] != ${run_help_orig_cmd:-$1} ]]
- do
- shift cmd_args || return 1
- done
- eval "run-help-$1:t ${(q@)cmd_args[2,-1]}"
+
+ # Discard the command itself & everything before it.
+ shift $cmd_args[(i)${run_help_orig_cmd:-$1}] cmd_args ||
+ return
+
+ # Discard options, parameter assignments & paths.
+ cmd_args=( ${cmd_args[@]:#([-+]*|*=*|*/*|\~*)} )
+
+ eval "run-help-$1:t ${(@q)cmd_args}"
else
POSIXLY_CORRECT=1 man $@:t
fi