mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-04 10:41:11 +02:00
56 lines
1.3 KiB
Text
56 lines
1.3 KiB
Text
#autoload
|
|
|
|
local name gropt format gname hidden hide match ign
|
|
|
|
gropt=(-J)
|
|
hide=()
|
|
match=()
|
|
ign=()
|
|
|
|
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
|
|
|
|
zstyle -s ":completion:${curcontext}:$1" hidden hidden
|
|
if [[ "$hidden" = (all|yes|true|1|on) ]]; then
|
|
[[ "$hidden" = all ]] && format=''
|
|
hide=(-n)
|
|
fi
|
|
zstyle -s ":completion:${curcontext}:$1" group-name gname &&
|
|
[[ -z "$gname" ]] && gname="$1"
|
|
zstyle -s ":completion:${curcontext}:$1" matcher match &&
|
|
match=(-M "${(q)match}")
|
|
if zstyle -a ":completion:${curcontext}:$1" ignored-patterns _comp_ignore; then
|
|
ign=(-F _comp_ignore)
|
|
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
|
|
eval "${name}=($hide $match $ign $gropt ${(q)gname} -X \"${format}\")"
|
|
else
|
|
eval "${name}=($hide $match $ign $gropt ${(q)gname})"
|
|
fi
|
|
else
|
|
if [[ -n "$format" ]]; then
|
|
eval "${name}=($hide $match $ign $gropt -default- -X \"${format}\")"
|
|
else
|
|
eval "${name}=($hide $match $ign $gropt -default-)"
|
|
fi
|
|
fi
|
|
|
|
return 0
|