1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2026-01-01 20:11:06 +01:00
zsh/Completion/Core/_description
1999-12-07 16:25:53 +00:00

47 lines
947 B
Text

#autoload
local name gropt format gname hidden hide
gropt=(-J)
hide=()
if [[ "$1" = -[VJ] ]]; then
gropt=("$1")
shift
elif [[ "$1" = -[VJ] ]]; then
gropt=("-${1[3,-1]}" "${1[1,2]}")
shift
fi
_lastdescr=( "$_lastdescr[@]" "$3" )
_setup "$1"
name="$2"
_style -s "$1" format format || _style -s descriptions format format
_style -s "$1" hidden hidden
if [[ "$hidden" = (all|yes|true|1|on) ]]; then
[[ "$hidden" = all ]] && format=''
hide=(-n)
fi
_style -s "$1" group-name gname && [[ -z "$gname" ]] && gname="$1"
shift 2
[[ -n "$format" ]] && compfmt format "$format" "d:$1" "${(@)argv[2,-1]}"
if [[ -n "$gname" ]]; then
if [[ -n "$format" ]]; then
eval "${name}=($hide $gropt ${(q)gname} -X \"${format}\")"
else
eval "${name}=($hide $gropt ${(q)gname})"
fi
else
if [[ -n "$format" ]]; then
eval "${name}=($hide -J -default- -X \"${format}\")"
else
eval "${name}=($hide -J -default-)"
fi
fi
return 0