summary refs log tree commit diff
path: root/Completion/Zsh/Command/_alias
diff options
context:
space:
mode:
authorOliver Kiddle <opk@users.sourceforge.net>2003-09-03 14:05:07 +0000
committerOliver Kiddle <opk@users.sourceforge.net>2003-09-03 14:05:07 +0000
commit4284171e9e15960996e0d77d11fde1e741145c16 (patch)
treee53501fd5be2ebc92000a77c8b05472dd3601d69 /Completion/Zsh/Command/_alias
parent8e359a669e064f16d9a3767a805da28af171d5e7 (diff)
downloadzsh-4284171e9e15960996e0d77d11fde1e741145c16.tar.gz
zsh-4284171e9e15960996e0d77d11fde1e741145c16.tar.xz
zsh-4284171e9e15960996e0d77d11fde1e741145c16.zip
19019: only complete aliases of the appropriate type for the alias builtin
Diffstat (limited to 'Completion/Zsh/Command/_alias')
-rw-r--r--Completion/Zsh/Command/_alias13
1 files changed, 8 insertions, 5 deletions
diff --git a/Completion/Zsh/Command/_alias b/Completion/Zsh/Command/_alias
index 8feb14a07..8b28f470a 100644
--- a/Completion/Zsh/Command/_alias
+++ b/Completion/Zsh/Command/_alias
@@ -1,11 +1,12 @@
 #compdef alias
 
-local curcontext="$curcontext" state line suf
+local curcontext="$curcontext" state line type suf
+typeset -A opt_args
 
 _arguments -C -s -A "-*" -S \
-  '-+g[list or define global aliases]' \
-  '-+r[list or define regular aliases]' \
-  '-+s[list or define suffix aliases]' \
+  '(-r +r -s +s)-+g[list or define global aliases]' \
+  '(-g +g -s +s)-+r[list or define regular aliases]' \
+  '(-r +r -g +g)-+s[list or define suffix aliases]' \
   '-+m[print aliases matching specified pattern]' \
   '-L[print each alias in the form of calls to alias]' \
   '*::alias definition:->defn'
@@ -16,6 +17,8 @@ if [[ -n "$state" ]]; then
     _normal
   else
     compset -S '=*' || suf='='
-    _wanted alias expl 'alias definition' _aliases -S "$suf"
+    type=( ${opt_args[(i)[-+][grs]]#?} )
+    (( $#type )) && type=( -s $type )
+    _wanted -x alias expl 'alias definition' _aliases -S "$suf" "$type[@]"
   fi
 fi