From fd4859bccb984c1fa8248706276838d07b1e5693 Mon Sep 17 00:00:00 2001 From: Sven Wischnowsky Date: Mon, 2 Apr 2001 11:20:15 +0000 Subject: moved from Completion/Core/_parameters --- Completion/Zsh/Type/_parameters | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 Completion/Zsh/Type/_parameters (limited to 'Completion/Zsh/Type') diff --git a/Completion/Zsh/Type/_parameters b/Completion/Zsh/Type/_parameters new file mode 100644 index 000000000..097a96760 --- /dev/null +++ b/Completion/Zsh/Type/_parameters @@ -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]}}%%:*}" -- cgit 1.4.1