1
0
mirror of git://git.code.sf.net/p/zsh/code synced 2024-11-19 21:44:11 +01:00
zsh/Completion/Core/_parameters
2000-10-10 14:12:41 +00:00

31 lines
776 B
Plaintext

#autoload
# This should be used to complete parameter names if you need some of the
# extra options of compadd. It completes only non-local parameters.
# If you specify a -g option with a pattern, the pattern will be used to
# restrict the type of parameters matched.
local expl pattern fakes faked tmp
pattern=(-g \*)
zparseopts -D -K -E g:=pattern
fakes=()
faked=()
if zstyle -a ":completion:${curcontext}:" fake-parameters tmp; then
for i in "$tmp[@]"; do
if [[ "$i" = *:* ]]; then
faked=( "$faked[@]" "$i" )
else
fakes=( "$fakes[@]" "$i" )
fi
done
fi
_wanted parameters expl parameter \
compadd "$@" -Q - \
"${(@k)parameters[(R)${pattern[2]}~*local*]}" \
"$fakes[@]" \
"${(@)${(@M)faked:#${~pattern[2]}}%%:*}"