1999-08-19 13:18:10 +02:00
|
|
|
#autoload
|
|
|
|
|
2000-04-01 22:43:43 +02:00
|
|
|
local name gropt=-J format gname hidden hide match opts
|
1999-08-19 13:18:10 +02:00
|
|
|
|
2000-04-01 22:43:43 +02:00
|
|
|
opts=()
|
|
|
|
|
|
|
|
if [[ "$1" = -([12]|)[VJ] ]]; then
|
|
|
|
gropt="$1"
|
1999-08-19 13:18:10 +02:00
|
|
|
shift
|
|
|
|
fi
|
|
|
|
|
2000-04-01 22:43:43 +02:00
|
|
|
_lastdescr=( "$_lastdescr[@]" "$3" )
|
|
|
|
|
|
|
|
_setup "$1"
|
|
|
|
|
|
|
|
name="$2"
|
|
|
|
|
|
|
|
zstyle -s ":completion:${curcontext}:$1" format format ||
|
|
|
|
zstyle -s ":completion:${curcontext}:descriptions" format format
|
|
|
|
|
2000-04-17 10:04:42 +02:00
|
|
|
if zstyle -s ":completion:${curcontext}:$1" hidden hidden &&
|
|
|
|
[[ "$hidden" = (all|yes|true|1|on) ]]; then
|
2000-04-01 22:43:43 +02:00
|
|
|
[[ "$hidden" = all ]] && format=''
|
|
|
|
opts=(-n)
|
|
|
|
fi
|
|
|
|
zstyle -s ":completion:${curcontext}:$1" group-name gname &&
|
|
|
|
[[ -z "$gname" ]] && gname="$1"
|
|
|
|
zstyle -s ":completion:${curcontext}:$1" matcher match &&
|
2000-05-23 10:54:30 +02:00
|
|
|
opts=($opts -M "$match")
|
|
|
|
[[ -n "$_matcher" ]] && opts=($opts -M "$_matcher")
|
2000-04-01 22:43:43 +02:00
|
|
|
|
2000-05-08 10:44:52 +02:00
|
|
|
if [[ -z "$_comp_no_ignore" ]]; then
|
2000-06-16 09:38:59 +02:00
|
|
|
zstyle -a ":completion:${curcontext}:$1" ignored-patterns _comp_ignore ||
|
2000-05-08 10:44:52 +02:00
|
|
|
_comp_ignore=()
|
2000-06-16 09:38:59 +02:00
|
|
|
|
|
|
|
zstyle -s ":completion:${curcontext}:$1" ignore-line hidden &&
|
|
|
|
case "$hidden" in
|
|
|
|
true|yes|on|1) _comp_ignore=( "$_comp_ignore[@]" "$words[@]" );;
|
|
|
|
current) _comp_ignore=( "$_comp_ignore[@]" "$words[CURRENT]" );;
|
|
|
|
other) _comp_ignore=( "$_comp_ignore[@]"
|
|
|
|
"${(@)words[1,CURRENT-1]}"
|
|
|
|
"${(@)words[CURRENT+1,-1]}" );;
|
|
|
|
esac
|
|
|
|
|
|
|
|
(( $#_comp_ignore )) && opts=( $opts -F _comp_ignore )
|
2000-04-01 22:43:43 +02:00
|
|
|
else
|
|
|
|
_comp_ignore=()
|
|
|
|
fi
|
|
|
|
|
|
|
|
shift 2
|
|
|
|
[[ -n "$format" ]] && zformat -f format "$format" "d:$1" "${(@)argv[2,-1]}"
|
|
|
|
|
|
|
|
if [[ -n "$gname" ]]; then
|
|
|
|
if [[ -n "$format" ]]; then
|
2000-05-23 10:54:30 +02:00
|
|
|
set -A "$name" "$opts[@]" "$gropt" "$gname" -X "$format"
|
1999-08-19 13:18:10 +02:00
|
|
|
else
|
2000-05-23 10:54:30 +02:00
|
|
|
set -A "$name" "$opts[@]" "$gropt" "$gname"
|
1999-08-19 13:18:10 +02:00
|
|
|
fi
|
|
|
|
else
|
2000-04-01 22:43:43 +02:00
|
|
|
if [[ -n "$format" ]]; then
|
2000-05-23 10:54:30 +02:00
|
|
|
set -A "$name" "$opts[@]" "$gropt" -default- -X "$format"
|
1999-08-19 13:18:10 +02:00
|
|
|
else
|
2000-05-23 10:54:30 +02:00
|
|
|
set -A "$name" "$opts[@]" "$gropt" -default-
|
1999-08-19 13:18:10 +02:00
|
|
|
fi
|
|
|
|
fi
|
2000-04-01 22:43:43 +02:00
|
|
|
|
|
|
|
return 0
|