1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-10-24 04:50:27 +02:00

51572: fix "shift" error when running standalone

This commit is contained in:
Bart Schaefer 2023-03-13 19:46:39 -07:00
parent 6725cbc05f
commit dd13048b3b
2 changed files with 5 additions and 3 deletions

View file

@ -98,13 +98,13 @@ do
if whence "run-help-$1:t" >/dev/null
then
local cmd_args
builtin getln cmd_args
builtin getln cmd_args &&
builtin print -z "$cmd_args"
cmd_args=( ${(z)cmd_args} )
cmd_args=( ${(z)${cmd_args:-"$*"}} )
# Discard the command itself & everything before it.
shift $cmd_args[(i)${run_help_orig_cmd:-$1}] cmd_args ||
return
continue
# Discard options, parameter assignments & paths.
cmd_args=( ${cmd_args[@]:#([-+]*|*=*|*/*|\~*)} )