about summary refs log tree commit diff
path: root/Completion/Base
diff options
context:
space:
mode:
authorDaniel Shahaf <d.s@daniel.shahaf.name>2020-04-27 19:30:40 +0000
committerDaniel Shahaf <d.s@daniel.shahaf.name>2020-05-03 01:27:36 +0000
commitdeca7c928520fba5a73383f1cac0b3ace8e0e45d (patch)
tree9e8e04cd5fbc8297fb033141ed8b0018b1eb2654 /Completion/Base
parent4d2bcf2fe7637b641ccde31a8ca7c4875f0699c1 (diff)
downloadzsh-deca7c928520fba5a73383f1cac0b3ace8e0e45d.tar.gz
zsh-deca7c928520fba5a73383f1cac0b3ace8e0e45d.tar.xz
zsh-deca7c928520fba5a73383f1cac0b3ace8e0e45d.zip
45730: _arguments: Add the -0 flag, which makes $opt_args be populated sanely.
Also, write/extend docstrings for sepjoin() and zjoin().
Diffstat (limited to 'Completion/Base')
-rw-r--r--Completion/Base/Utility/_arguments8
1 files changed, 5 insertions, 3 deletions
diff --git a/Completion/Base/Utility/_arguments b/Completion/Base/Utility/_arguments
index 136dd5826..3f1b39304 100644
--- a/Completion/Base/Utility/_arguments
+++ b/Completion/Base/Utility/_arguments
@@ -7,11 +7,13 @@ local long cmd="$words[1]" descr odescr mesg subopts opt opt2 usecc autod
 local oldcontext="$curcontext" hasopts rawret optarg singopt alwopt
 local setnormarg start rest
 local -a match mbegin mend
+integer opt_args_use_NUL_separators=0
 
 subopts=()
 singopt=()
-while [[ "$1" = -([AMO]*|[CRSWnsw]) ]]; do
+while [[ "$1" = -([AMO]*|[0CRSWnsw]) ]]; do
   case "$1" in
+  -0) opt_args_use_NUL_separators=1; shift ;;
   -C)  usecc=yes; shift ;;
   -O)  subopts=( "${(@P)2}" ); shift 2 ;;
   -O*) subopts=( "${(@P)${1[3,-1]}}" ); shift ;;
@@ -388,7 +390,7 @@ if (( $# )) && comparguments -i "$autod" "$singopt[@]" "$@"; then
             if [[ "$action" = -\>* ]]; then
 	      action="${${action[3,-1]##[ 	]#}%%[ 	]#}"
 	      if (( ! $state[(I)$action] )); then
-                comparguments -W line opt_args
+                comparguments -W line opt_args $opt_args_use_NUL_separators
                 state+=( "$action" )
                 state_descr+=( "$descr" )
 	        if [[ -n "$usecc" ]]; then
@@ -406,7 +408,7 @@ if (( $# )) && comparguments -i "$autod" "$singopt[@]" "$@"; then
                 local=yes
               fi
 
-              comparguments -W line opt_args
+              comparguments -W line opt_args $opt_args_use_NUL_separators
 
               if [[ "$action" = \ # ]]; then