mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-10-18 13:01:05 +02:00
moved from Completion/Core/_parameters
This commit is contained in:
parent
9dff5d2d9b
commit
fd4859bccb
1 changed files with 30 additions and 0 deletions
30
Completion/Zsh/Type/_parameters
Normal file
30
Completion/Zsh/Type/_parameters
Normal file
|
@ -0,0 +1,30 @@
|
|||
#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]}}%%:*}"
|
Loading…
Reference in a new issue