aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOliver Kiddle <opk@users.sourceforge.net>2003-11-13 17:45:35 +0000
committerOliver Kiddle <opk@users.sourceforge.net>2003-11-13 17:45:35 +0000
commit190c0b14719b4a4fd376654f10cabbb1c7716f3a (patch)
tree094aa24502e3e6ad7077ad7e263a46f22f3b4629
parent824961fd6dee35f650b5e29181d22fc71f14fd3a (diff)
downloadzsh-190c0b14719b4a4fd376654f10cabbb1c7716f3a.tar.gz
zsh-190c0b14719b4a4fd376654f10cabbb1c7716f3a.tar.xz
zsh-190c0b14719b4a4fd376654f10cabbb1c7716f3a.zip
merge 19019 back from 4.1 (with tweaks)
-rw-r--r--ChangeLog6
-rw-r--r--Completion/Zsh/Command/_alias23
-rw-r--r--Completion/Zsh/Command/_unhash13
3 files changed, 42 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index aa354e62d..5006925e8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -45,6 +45,12 @@
to no longer suggest that setting the PATH here (without proper
precautions) is a safe thing to do.
+2003-09-03 Oliver Kiddle <opk@zsh.org>
+
+ * 19019: Completion/Zsh/Command/_alias,
+ Completion/Zsh/Command/_unhash: only complete aliases of the
+ appropriate type for the alias builtin
+
2003-08-30 Peter Stephenson <pws@pwstephenson.fsnet.co.uk>
* c.f. somewhat terse reference in zsh-users/6493:
diff --git a/Completion/Zsh/Command/_alias b/Completion/Zsh/Command/_alias
new file mode 100644
index 000000000..be4aa60bf
--- /dev/null
+++ b/Completion/Zsh/Command/_alias
@@ -0,0 +1,23 @@
+#compdef alias
+
+local curcontext="$curcontext" state line expl type suf
+typeset -A opt_args
+
+_arguments -C -s -A "-*" -S \
+ '(-r +r)-+g[list or define global aliases]' \
+ '(-g +g)-+r[list or define regular aliases]' \
+ '-+m[print aliases matching specified pattern]' \
+ '-L[print each alias in the form of calls to alias]' \
+ '*::alias definition:->defn'
+
+if [[ -n "$state" ]]; then
+ if compset -P 1 '*='; then
+ compset -q
+ _normal
+ else
+ compset -S '=*' || suf='='
+ type=( ${opt_args[(i)[-+][gr]]#?} )
+ (( $#type )) && type=( -s $type )
+ _wanted alias expl 'alias definition' _aliases -S "$suf" "$type[@]"
+ fi
+fi
diff --git a/Completion/Zsh/Command/_unhash b/Completion/Zsh/Command/_unhash
new file mode 100644
index 000000000..88484385e
--- /dev/null
+++ b/Completion/Zsh/Command/_unhash
@@ -0,0 +1,13 @@
+#compdef unhash
+
+local expl state line curcontext="$curcontext"
+
+_arguments -C -s -S \
+ '(-a -f *)-d[remove named directories]:*:named directory:->nameddir' \
+ '(-d -f *)-a[remove aliases]:*:aliases:_aliases' \
+ '(-d -a *)-f[remove functions]:*:functions:_functions' \
+ '-m[treat arguments as patterns]' \
+ '(-a -d -f -m)*:command: _command_names -e' && return 0
+
+[[ "$state" = nameddir ]] &&
+ _wanted named-directories expl 'named directory' compadd -k nameddirs