2000-05-28 21:40:22 +02:00
|
|
|
#compdef which whence where type
|
1999-04-15 20:05:38 +02:00
|
|
|
|
2000-05-28 21:40:22 +02:00
|
|
|
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]'
|
|
|
|
|
2001-02-26 14:02:30 +01:00
|
|
|
case ${service} in
|
2000-05-28 21:40:22 +02:00
|
|
|
whence)
|
2001-04-01 18:19:15 +02:00
|
|
|
_arguments -C -s -A "-*" -S \
|
2000-05-28 21:40:22 +02:00
|
|
|
'(-c -w)-v[verbose output]' \
|
|
|
|
'(-v -w)-c[csh-like output]' \
|
|
|
|
"${cargs[@]}" "$farg" "$aarg" && return 0
|
|
|
|
;;
|
2001-04-01 18:19:15 +02:00
|
|
|
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;;
|
2000-05-28 21:40:22 +02:00
|
|
|
esac
|
|
|
|
|
|
|
|
if [[ "$state" = command ]]; then
|
|
|
|
|
|
|
|
args=( "$@" )
|
|
|
|
|
|
|
|
_alternative -O args \
|
2000-05-31 11:38:25 +02:00
|
|
|
'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'
|
2000-05-28 21:40:22 +02:00
|
|
|
|
|
|
|
fi
|