about summary refs log tree commit diff
path: root/Completion/Zsh/Command
diff options
context:
space:
mode:
authorSven Wischnowsky <wischnow@users.sourceforge.net>2001-04-02 11:32:30 +0000
committerSven Wischnowsky <wischnow@users.sourceforge.net>2001-04-02 11:32:30 +0000
commit231c21954a75917f9d6e4370856ff170bcee9c2a (patch)
tree472003b05527364810b4a13cdc5accafbf228ca0 /Completion/Zsh/Command
parent26e5fe67ce21ddd545503a646ca36c013198bf4f (diff)
downloadzsh-231c21954a75917f9d6e4370856ff170bcee9c2a.tar.gz
zsh-231c21954a75917f9d6e4370856ff170bcee9c2a.tar.xz
zsh-231c21954a75917f9d6e4370856ff170bcee9c2a.zip
moved from Completion/Builtins/_which
Diffstat (limited to 'Completion/Zsh/Command')
-rw-r--r--Completion/Zsh/Command/_which37
1 files changed, 37 insertions, 0 deletions
diff --git a/Completion/Zsh/Command/_which b/Completion/Zsh/Command/_which
new file mode 100644
index 000000000..ab6caeba7
--- /dev/null
+++ b/Completion/Zsh/Command/_which
@@ -0,0 +1,37 @@
+#compdef which whence where type
+
+local farg aarg cargs args state line curcontext="$curcontext"
+
+cargs=( \
+  '(-v -c)-w[print command type]' \
+  '-p[always do a path search]' \
+  '-m[treat the arguments as patterns]' \
+  '-s[print symlink free path as well]' \
+  '*:commands:->command' )
+farg='-f[output contents of functions]'
+aarg='-a[print all occurences in path]'
+
+case ${service} in
+  whence)
+    _arguments -C -s -A "-*" -S \
+      '(-c -w)-v[verbose output]' \
+      '(-v -w)-c[csh-like output]' \
+      "${cargs[@]}" "$farg" "$aarg" && return 0
+  ;;
+  where) _arguments -C -s -A "-*" -S "${cargs[@]}" && return 0;;
+  which) _arguments -C -s -A "-*" -S "${cargs[@]}" "$aarg" && return 0;;
+  type) _arguments -C -s -A "-*" -S "${cargs[@]}" "$aarg" "$farg" && return 0;;
+esac
+
+if [[ "$state" = command ]]; then
+
+  args=( "$@" )
+
+  _alternative -O args \
+    'commands:external command:compadd -k commands' \
+    'builtins:builtin command:compadd -k builtins' \
+    'functions:shell function:compadd -k functions' \
+    'aliases:alias:compadd -k aliases' \
+    'reserved-words:reserved word:compadd -k reswords'
+
+fi