diff options
Diffstat (limited to 'Functions/Misc/run-help')
-rw-r--r-- | Functions/Misc/run-help | 15 |
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 |