1
0
mirror of git://git.code.sf.net/p/zsh/code synced 2024-11-20 05:53:52 +01:00
zsh/Completion/User/_gdb

56 lines
1.7 KiB
Plaintext
Raw Normal View History

1999-07-19 16:26:17 +02:00
#compdef gdb
2000-04-01 22:43:43 +02:00
local cur="$words[CURRENT]" prev w list ret=1 expl
1999-07-19 16:26:17 +02:00
2000-04-01 22:43:43 +02:00
[[ "$PREFIX" = --* ]] &&
_arguments -- '*=(CORE|SYM)FILE:core file:_files' \
'*=EXECFILE:executable:_files \*\(-\*\)' \
'*=TTY:terminal device:compadd /dev/tty\*' && return 0
1999-07-19 16:26:17 +02:00
if compset -P '-(cd|directory)='; then
_files -/
elif compset -P '-tty='; then
2000-04-01 22:43:43 +02:00
_wanted devices expl 'terminal device' compadd - /dev/tty*
1999-07-19 16:26:17 +02:00
elif compset -P '-(exec|se)='; then
2000-04-01 22:43:43 +02:00
_description files expl executable
_files "$expl[@]" -g '*(-*)'
1999-07-19 16:26:17 +02:00
elif compset -P '-(symbols|core|command)='; then
_files
2000-04-01 22:43:43 +02:00
elif [[ "$PREFIX" = -* ]]; then
_tags options
while _tags; do
2000-04-01 22:43:43 +02:00
while _next_label options expl option; do
compadd "$expl[@]" -QS '' - -symbols\= -exec\= -se\= -core\= -command\= \
-directory\= -cd\= -tty\= && ret=0
compadd "$expl[@]" - -help -h -s -e -c -x -d -nx -n -quiet -q \
-batch -fullname -f -b && ret=0
done
2000-04-03 17:27:14 +02:00
(( ret )) || return 0
done
1999-07-19 16:26:17 +02:00
else
prev="$words[CURRENT-1]"
case "$prev" in
2000-04-01 22:43:43 +02:00
(-d) _files -/ && return 0 ;;
1999-07-19 16:26:17 +02:00
(-[csx]) _files && return 0 ;;
2000-04-01 22:43:43 +02:00
(-e) _description files expl executable
_files "$expl[@]" -g '*(-*)' && return 0 ;;
(-b) _wanted -V values expl 'baud rate' \
compadd 0 50 75 110 134 150 200 300 600 1200 1800 2400 4800 \
9600 19200 38400 57600 115200 230400 && return 0 ;;
1999-07-19 16:26:17 +02:00
esac
2000-04-01 22:43:43 +02:00
1999-07-19 16:26:17 +02:00
w=( "${(@)words[2,-1]}" )
while [[ "$w[1]" = -* ]]; do
[[ "$w[1]" = -[decsxb] ]] && shift 1 w
shift 1 w
done
if [[ $#w -gt 1 ]]; then
2000-04-01 22:43:43 +02:00
_alternative 'files:: _files' "processes:: _pids -m ${w[1]:t}"
1999-07-19 16:26:17 +02:00
else
2000-04-01 22:43:43 +02:00
_description files expl executable
_files "$expl[@]" -g '*(-*)'
1999-07-19 16:26:17 +02:00
fi
fi