1 #compdef which whence where type
3 local farg aarg cargs args state line curcontext="$curcontext" ret=1
6 '(-v -c)-w[print command type]' \
7 '-p[always do a path search]' \
8 '-m[treat the arguments as patterns]' \
9 '-s[print symlink free path as well]' \
10 '*:commands:->command' )
11 farg='-f[output contents of functions]'
12 aarg='-a[print all occurrences in path]'
16 _arguments -C -s -A "-*" -S \
17 '(-c -w)-v[verbose output]' \
18 '(-v -w)-c[csh-like output]' \
19 "${cargs[@]}" "$farg" "$aarg" && ret=0
21 where) _arguments -C -s -A "-*" -S "${cargs[@]}" && ret=0;;
22 which) _arguments -C -s -A "-*" -S "${cargs[@]}" "$aarg" && ret=0;;
23 type) _arguments -C -s -A "-*" -S "${cargs[@]}" "$aarg" "$farg" && ret=0;;
26 if [[ "$state" = command ]]; then
30 _alternative -O args \
31 'commands:external command:_path_commands' \
32 'builtins:builtin command:compadd -k builtins' \
33 'functions:shell function:compadd -k functions' \
34 'aliases:alias:compadd -k aliases' \
35 'reserved-words:reserved word:compadd -k reswords' && ret=0