summaryrefslogtreecommitdiffstats
path: root/Completion/Base/_values
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>1999-11-12 15:28:24 +0000
committerTanaka Akira <akr@users.sourceforge.net>1999-11-12 15:28:24 +0000
commite6282df1155e8d9b08b2e518a452c1997973f1ce (patch)
treeb0c8ed7e8512cc4397ae7df6d138ea66147565b3 /Completion/Base/_values
parentzsh-workers/8617 (diff)
downloadzsh-e6282df1155e8d9b08b2e518a452c1997973f1ce.tar
zsh-e6282df1155e8d9b08b2e518a452c1997973f1ce.tar.gz
zsh-e6282df1155e8d9b08b2e518a452c1997973f1ce.tar.bz2
zsh-e6282df1155e8d9b08b2e518a452c1997973f1ce.tar.lz
zsh-e6282df1155e8d9b08b2e518a452c1997973f1ce.tar.xz
zsh-e6282df1155e8d9b08b2e518a452c1997973f1ce.tar.zst
zsh-e6282df1155e8d9b08b2e518a452c1997973f1ce.zip
manual/8630
Diffstat (limited to 'Completion/Base/_values')
-rw-r--r--Completion/Base/_values35
1 files changed, 26 insertions, 9 deletions
diff --git a/Completion/Base/_values b/Completion/Base/_values
index aac8b392d..e4d61d288 100644
--- a/Completion/Base/_values
+++ b/Completion/Base/_values
@@ -1,12 +1,27 @@
#autoload
+local subopts
+
+if [[ "$1" = -O?* ]]; then
+ subopts=( "${(@P)1[3,-1]}" )
+ shift
+if [[ "$1" = -O ]]; then
+ subopts=( "${(@P)1}" )
+ shift 2
+else
+ subopts=()
+fi
+
if compvalues -i "$@"; then
- local noargs args opts descr action expl sep
+ local noargs args opts descr action expl sep _sub_context oldsc="$_sub_context"
if ! compvalues -D descr action; then
- _tags value || return 1
+ compvalues -C _sub_context
+ _sub_context="${oldsc}:${oldsc+${oldsc}-}${_sub_context}"
+
+ _tags "${_sub_context}" values || return 1
compvalues -V noargs args opts
@@ -32,7 +47,8 @@ if compvalues -i "$@"; then
PREFIX="$prefix"
SUFFIX="$suffix"
IPREFIX="${IPREFIX}${args[1]%%:*}="
- compvalues -L "${args[1]%%:*}" descr action
+ compvalues -L "${args[1]%%:*}" descr action _sub_context
+ _sub_context="${oldsc}:${oldsc+${oldsc}-}${_sub_context}"
fi
else
compvalues -d descr
@@ -49,9 +65,12 @@ if compvalues -i "$@"; then
return
fi
+ else
+ compvalues -C _sub_context
+ _sub_context="${oldsc}:${oldsc+${oldsc}-}${_sub_context}"
fi
- _tags argument || return 1
+ _tags "${oldsc}:any" arguments || return 1
_description expl "$descr"
@@ -85,13 +104,13 @@ if compvalues -i "$@"; then
eval ws\=\( "${action[3,-3]}" \)
- _describe "$descr" ws -M 'r:|[_-]=* r:|=*'
+ _describe "$descr" ws -M 'r:|[_-]=* r:|=*' "$subopts[@]"
elif [[ "$action" = \(*\) ]]; then
# Anything inside `(...)' is added directly.
- compadd "$expl[@]" - ${=action[2,-2]}
+ compadd "$subopts[@]" "$expl[@]" - ${=action[2,-2]}
elif [[ "$action" = \{*\} ]]; then
# A string in braces is evaluated.
@@ -108,13 +127,11 @@ if compvalues -i "$@"; then
# Otherwise we call it with the description-arguments built above.
action=( $=action )
- ${(e)action[1]} "$expl[@]" ${(e)~action[2,-1]}
+ ${(e)action[1]} "$subopts[@]" "$expl[@]" ${(e)~action[2,-1]}
fi
fi
[[ nm -ne "$compstate[nmatches]" ]]
- return
-
else
return 1;
fi