1
0
mirror of git://git.code.sf.net/p/zsh/code synced 2024-11-20 14:04:03 +01:00
zsh/Completion/Builtins/_signals

39 lines
807 B
Plaintext
Raw Normal View History

1999-11-19 10:20:30 +01:00
#autoload
# Options (only in separate words):
#
# -a use all signals (even the pseudo-signals)
# -p needs a `-' prefix
#
# A `-' or `--' as the first argument is ignored.
local expl last=-3 minus
while [[ "$1" = -[ap] ]]; do
if [[ "$1" = -a ]]; then
last=-1
else
minus=-
fi
shift
done
[[ "$1" = -(|-) ]] && shift
2000-04-01 22:43:43 +02:00
if _wanted signals &&
{ [[ -z "$minus" ]] ||
! zstyle -T ":completion:${curcontext}:signals" prefix-needed ||
1999-11-19 10:20:30 +01:00
[[ "$PREFIX" = -* ]] } ; then
local disp tmp
2000-04-01 22:43:43 +02:00
if zstyle -t ":completion:${curcontext}:signals" prefix-hidden; then
1999-11-19 10:20:30 +01:00
tmp=( "${(@)signals[1,last]}" )
disp=(-d tmp)
else
disp=()
fi
2000-04-01 22:43:43 +02:00
_all_labels signals expl signal \
compadd "$@" "$disp[@]" -M 'm:{a-z}={A-Z}' - \
"${minus}${(@)^signals[1,last]}"
1999-11-19 10:20:30 +01:00
fi