1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-01-17 22:31:12 +01:00
zsh/Completion/Builtins/_vars

25 lines
592 B
Text
Raw Normal View History

1999-11-14 20:57:24 +01:00
#compdef getopts read unset vared
# This will handle completion of keys of associative arrays, e.g. at
1999-11-15 13:01:46 +01:00
# `vared foo[<TAB>'. However, in this version the [ must be added
# by hand.
1999-11-14 20:57:24 +01:00
if [[ $PREFIX = *\[* ]]; then
local var=${PREFIX%%\[*}
local elt="${PREFIX#*\]}${SUFFIX%\]}"
local addclose
compset -p $(( ${#var} + 1 ))
if ! compset -S \]; then
addclose=(-S ']')
fi
if [[ ${(tP)var} = assoc* ]]; then
local expl
2000-03-23 05:19:26 +01:00
_wanted -C subscript association-keys expl 'association key' \
compadd $addclose - ${(kP)var}
1999-11-14 20:57:24 +01:00
fi
else
2000-03-23 05:19:26 +01:00
_wanted parameters && _parameters
1999-11-14 20:57:24 +01:00
fi