mirror of
git://git.code.sf.net/p/zsh/code
synced 2024-11-19 21:44:11 +01:00
64 lines
1.5 KiB
Plaintext
64 lines
1.5 KiB
Plaintext
#autoload
|
|
|
|
local name gropt=-J format gname hidden hide match opts
|
|
|
|
opts=()
|
|
|
|
if [[ "$1" = -([12]|)[VJ] ]]; then
|
|
gropt="$1"
|
|
shift
|
|
fi
|
|
|
|
_lastdescr=( "$_lastdescr[@]" "$3" )
|
|
|
|
_setup "$1"
|
|
|
|
name="$2"
|
|
|
|
zstyle -s ":completion:${curcontext}:$1" format format ||
|
|
zstyle -s ":completion:${curcontext}:descriptions" format format
|
|
|
|
if zstyle -s ":completion:${curcontext}:$1" hidden hidden &&
|
|
[[ "$hidden" = (all|yes|true|1|on) ]]; then
|
|
[[ "$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 &&
|
|
opts=($opts -M "$match")
|
|
[[ -n "$_matcher" ]] && opts=($opts -M "$_matcher")
|
|
|
|
if [[ -z "$_comp_no_ignore" ]]; then
|
|
if zstyle -a ":completion:${curcontext}:$1" ignored-patterns _comp_ignore; then
|
|
opts=( $opts -F _comp_ignore )
|
|
zstyle -t ":completion:${curcontext}:$1" ignore-line &&
|
|
_comp_ignore=( "$_comp_ignore[@]" "$words[@]" )
|
|
elif zstyle -t ":completion:${curcontext}:$1" ignore-line; then
|
|
_comp_ignore=( "$words[@]" )
|
|
else
|
|
_comp_ignore=()
|
|
fi
|
|
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
|
|
set -A "$name" "$opts[@]" "$gropt" "$gname" -X "$format"
|
|
else
|
|
set -A "$name" "$opts[@]" "$gropt" "$gname"
|
|
fi
|
|
else
|
|
if [[ -n "$format" ]]; then
|
|
set -A "$name" "$opts[@]" "$gropt" -default- -X "$format"
|
|
else
|
|
set -A "$name" "$opts[@]" "$gropt" -default-
|
|
fi
|
|
fi
|
|
|
|
return 0
|