summaryrefslogtreecommitdiff
path: root/Completion/Builtins
diff options
context:
space:
mode:
authorOliver Kiddle <opk@users.sourceforge.net>2000-08-10 21:22:25 +0000
committerOliver Kiddle <opk@users.sourceforge.net>2000-08-10 21:22:25 +0000
commit5851a32681f5fbdbc55987cb117f891e3745f13c (patch)
tree1dfb2778e27187407068f0846f139b3f827a7391 /Completion/Builtins
parent5b04efd73cba5e3ebf0e919e68ba7f2baae4734e (diff)
downloadzsh-5851a32681f5fbdbc55987cb117f891e3745f13c.tar.gz
zsh-5851a32681f5fbdbc55987cb117f891e3745f13c.zip
add -g option to _parameters to restrict type of parameters completed (12583)
Diffstat (limited to 'Completion/Builtins')
-rw-r--r--Completion/Builtins/_arrays2
-rw-r--r--Completion/Builtins/_vars17
-rw-r--r--Completion/Builtins/_zpty4
3 files changed, 16 insertions, 7 deletions
diff --git a/Completion/Builtins/_arrays b/Completion/Builtins/_arrays
index 5ab6d41f0..c28fb179e 100644
--- a/Completion/Builtins/_arrays
+++ b/Completion/Builtins/_arrays
@@ -2,4 +2,4 @@
local expl
-_wanted arrays expl array compadd -k "parameters[(R)*array*~*local*]"
+_wanted arrays expl array _parameters "$@" -g '*array*'
diff --git a/Completion/Builtins/_vars b/Completion/Builtins/_vars
index a46b99de0..501e37b4f 100644
--- a/Completion/Builtins/_vars
+++ b/Completion/Builtins/_vars
@@ -1,8 +1,9 @@
#compdef getopts unset vared
# This will handle completion of keys of associative arrays, e.g. at
-# `vared foo[<TAB>'. However, in this version the [ must be added
-# by hand.
+# `vared foo[<TAB>'.
+
+local ret=1
if [[ $PREFIX = *\[* ]]; then
local var=${PREFIX%%\[*}
@@ -11,7 +12,7 @@ if [[ $PREFIX = *\[* ]]; then
compset -p $(( ${#var} + 1 ))
if ! compset -S \]; then
- addclose=(-S ']')
+ addclose=(-S "${${QIPREFIX:+]}:-\]}")
fi
if [[ ${(tP)var} = assoc* ]]; then
local expl
@@ -20,5 +21,13 @@ if [[ $PREFIX = *\[* ]]; then
compadd $addclose -k "$var"
fi
else
- _parameters "$@"
+ _parameters -g '^a*' "$@" && ret=0
+
+ if compset -S '\[*'; then
+ set - -S "" "$@"
+ else
+ set - -qS"${${QIPREFIX:+[}:-\[}" "$@"
+ fi
+ _parameters -g 'a*' "$@" && ret=0
+ return ret
fi
diff --git a/Completion/Builtins/_zpty b/Completion/Builtins/_zpty
index f1de3d11d..b7e355149 100644
--- a/Completion/Builtins/_zpty
+++ b/Completion/Builtins/_zpty
@@ -10,7 +10,7 @@ _arguments -C -s \
'(-r -w -L -e -b)-d[delete command]:*:name:->name' \
'(-r -L -e -b -d)-w[send string to command]:name:->name:*:strings to write' \
'(: -r -w -e -b -d)-L[list defined commands as calls]' \
- '(: -w -L -e -b -d)-r[read string from command]:name:->name:param: _parameters:pattern:' \
+ '(: -w -L -e -b -d)-r[read string from command]:name:->name:param: _vars:pattern:' \
'(-r -w -L -d):zpty command name:' \
'(-r -w -L -d):cmd: _command_names -e' \
'(-r -w -L -d)*::args:_precommand' && return 0
@@ -21,7 +21,7 @@ _arguments -C -s \
# - read \
# '-r[read string from command]' \
# ':name:->name' \
-# ':param: _parameters' \
+# ':param: _vars' \
# ':pattern:' \
# - write \
# '-w[send string to command]' \