about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBart Schaefer <schaefer@zsh.org>2023-03-13 19:46:39 -0700
committerBart Schaefer <schaefer@zsh.org>2023-03-13 19:46:39 -0700
commitdd13048b3b8cf710f44424ce9fedc2b56c31fde3 (patch)
tree134e8f553ccb07ac4e179adf76e31ef48802facc
parent6725cbc05fc7943290896ae80d706f335eec96ba (diff)
downloadzsh-dd13048b3b8cf710f44424ce9fedc2b56c31fde3.tar.gz
zsh-dd13048b3b8cf710f44424ce9fedc2b56c31fde3.tar.xz
zsh-dd13048b3b8cf710f44424ce9fedc2b56c31fde3.zip
51572: fix "shift" error when running standalone
-rw-r--r--ChangeLog2
-rw-r--r--Functions/Misc/run-help6
2 files changed, 5 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index e80b09833..7ecc36a67 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2023-03-13  Bart Schaefer  <schaefer@zsh.org>
 
+	* 51572: Functions/Misc/run-help: fix error when running standalone
+
 	* Sven Joachim: 51563: Completion/Debian/Command/_sbuild: unmatched "
 
 2023-03-11  Bart Schaefer  <schaefer@zsh.org>
diff --git a/Functions/Misc/run-help b/Functions/Misc/run-help
index d52c1b032..14d09bd65 100644
--- a/Functions/Misc/run-help
+++ b/Functions/Misc/run-help
@@ -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[@]:#([-+]*|*=*|*/*|\~*)} )