1
0
mirror of git://git.code.sf.net/p/zsh/code synced 2024-11-20 05:53:52 +01:00
zsh/Completion/Core/_all_labels
2000-04-01 20:43:43 +00:00

45 lines
816 B
Plaintext

#autoload
local gopt=-J len tmp pre suf tloop ret=1 descr
if [[ "$1" = -t ]]; then
tloop=yes
shift
fi
if [[ "$1" = -([12]|)[VJ] ]]; then
gopt="$1"
shift
fi
tmp=${argv[(ib:4:)-]}
len=$#
if [[ tmp -lt len ]]; then
pre=$(( tmp-1 ))
suf=$tmp
elif [[ tmp -eq $# ]]; then
pre=-2
suf=$(( len+1 ))
else
pre=4
suf=5
fi
while [[ -z "$tloop" ]] || comptags -N; do
while comptags -A "$1" curtag; do
if [[ "$curtag" = *:* ]]; then
zformat -f descr "${curtag#*:}" "d:$3"
_description "$gopt" "${curtag%:*}" "$2" "$descr"
curtag="${curtag%:*}"
"$4" "${(P@)2}" "${(@)argv[5,-1]}"
else
_description "$gopt" "$curtag" "$2" "$3"
"${(@)argv[4,pre]}" "${(P@)2}" "${(@)argv[suf,-1]}" && ret=0
fi
done
[[ -z "$tloop" || ret -eq 0 ]] && break
done
return ret