about summary refs log tree commit diff
path: root/Completion
diff options
context:
space:
mode:
authorSven Wischnowsky <wischnow@users.sourceforge.net>2001-05-08 12:24:21 +0000
committerSven Wischnowsky <wischnow@users.sourceforge.net>2001-05-08 12:24:21 +0000
commit83032fe8761f8830f4894aad6e84cbe46bbe7512 (patch)
tree34c816fa0d40faccb11fdcc1d4c4deb25ec45e19 /Completion
parent671fda58c0cf5c37232854fcc0b7f72c94287a89 (diff)
downloadzsh-83032fe8761f8830f4894aad6e84cbe46bbe7512.tar.gz
zsh-83032fe8761f8830f4894aad6e84cbe46bbe7512.tar.xz
zsh-83032fe8761f8830f4894aad6e84cbe46bbe7512.zip
add -S option to specify separator between values and their arguments; make _values add the value-separator as a suffix for most types of actions (14257)
Diffstat (limited to 'Completion')
-rw-r--r--Completion/Base/Utility/_values27
1 files changed, 15 insertions, 12 deletions
diff --git a/Completion/Base/Utility/_values b/Completion/Base/Utility/_values
index cb90ed578..e074e1393 100644
--- a/Completion/Base/Utility/_values
+++ b/Completion/Base/Utility/_values
@@ -13,9 +13,12 @@ done
 
 if compvalues -i "$@"; then
 
-  local noargs args opts descr action expl sep subc
+  local noargs args opts descr action expl sep argsep subc test='*'
   local oldcontext="$curcontext"
 
+  compvalues -S argsep
+  compvalues -s sep && [[ -n "$sep" ]] && test="[^${(q)sep}]#"
+
   if ! compvalues -D descr action; then
 
     _tags values || return 1
@@ -24,17 +27,17 @@ if compvalues -i "$@"; then
 
     compvalues -V noargs args opts
 
-    if [[ "$PREFIX" = *\=* ]]; then
+    if [[ "$PREFIX" = *${argsep}${~test} ]]; then
       local name
 
-      name="${PREFIX%%\=*}"
+      name="${PREFIX%%${argsep}*}"
       if compvalues -L "$name" descr action; then
-        IPREFIX="${IPREFIX}${name}="
-        PREFIX="${PREFIX#*\=}"
+        IPREFIX="${IPREFIX}${name}${argsep}"
+        PREFIX="${PREFIX#*${argsep}}"
       else
         local prefix suffix
 
-	prefix="${PREFIX#*\=}"
+	prefix="${PREFIX#*${argsep}}"
 	suffix="$SUFFIX"
 	PREFIX="$name"
 	SUFFIX=''
@@ -45,7 +48,7 @@ if compvalues -i "$@"; then
 
         PREFIX="$prefix"
 	SUFFIX="$suffix"
-        IPREFIX="${IPREFIX}${args[1]%%:*}="
+        IPREFIX="${IPREFIX}${args[1]%%:*}${argsep}"
 	compvalues -L "${args[1]%%:*}" descr action subc
 	curcontext="${oldcontext%:*}:$subc"
       fi
@@ -59,8 +62,8 @@ if compvalues -i "$@"; then
 
       _describe "$descr" \
         noargs "$sep[@]" -M 'r:|[_-]=* r:|=*' -- \
-        args -S= -M 'r:|[_-]=* r:|=*' -- \
-        opts -qS= -M 'r:|[_-]=* r:|=*'
+        args -S "${argsep}" -M 'r:|[_-]=* r:|=*' -- \
+        opts -qS "${argsep}" -M 'r:|[_-]=* r:|=*'
 
       curcontext="$oldcontext"
 
@@ -82,7 +85,7 @@ if compvalues -i "$@"; then
   # we have only one possible value left.
 
   [[ ${#snames}+${#names}+${#onames} -ne 1 ]] && compvalues -s sep &&
-      expl=( "-qS$sep" "$expl[@]" )
+      expl=( "-qS$sep" "$expl[@]" ) sep=( "-qS$sep" )
 
   if [[ "$action" = -\>* ]]; then
     compvalues -v val_args
@@ -113,7 +116,7 @@ if compvalues -i "$@"; then
 
       eval ws\=\( "${action[3,-3]}" \)
 
-      _describe "$descr" ws -M 'r:|[_-]=* r:|=*' "$subopts[@]"
+      _describe "$descr" ws -M 'r:|[_-]=* r:|=*' "$subopts[@]" "$sep[@]"
 
     elif [[ "$action" = \(*\) ]]; then
 
@@ -121,7 +124,7 @@ if compvalues -i "$@"; then
 
       eval ws\=\( "${action[2,-2]}" \)
 
-      _all_labels arguments expl "$descr" compadd "$subopts[@]" -a - ws
+      _all_labels arguments expl "$descr" compadd "$subopts[@]" "$sep[@]" -a - ws
     elif [[ "$action" = \{*\} ]]; then
 
       # A string in braces is evaluated.