about summary refs log tree commit diff
path: root/Completion/User/_gdb
diff options
context:
space:
mode:
Diffstat (limited to 'Completion/User/_gdb')
-rw-r--r--Completion/User/_gdb27
1 files changed, 12 insertions, 15 deletions
diff --git a/Completion/User/_gdb b/Completion/User/_gdb
index dab301b39..d037b83d9 100644
--- a/Completion/User/_gdb
+++ b/Completion/User/_gdb
@@ -10,19 +10,19 @@ local cur="$words[CURRENT]" prev w list ret=1 expl
 if compset -P '-(cd|directory)='; then
   _files -/
 elif compset -P '-tty='; then
-  _description expl 'terminal device'
-  compadd "$expl[@]" - /dev/tty*
+  _wanted devices expl 'terminal device' && compadd "$expl[@]" - /dev/tty*
 elif compset -P '-(exec|se)='; then
   _description expl executable
   _files "$expl[@]" -g '*(*)'
 elif compset -P '-(symbols|core|command)='; then
   _files
 elif [[ "$PREFIX" = -* ]]; then
-  _description expl option
-  compadd "$expl[@]" -QS '' - -symbols\= -exec\= -se\= -core\= -command\= \
-                              -directory\= -cd\= -tty\=
-  compadd "$expl[@]"        - -help -h -s -e -c -x -d -nx -n -quiet -q \
-			      -batch -fullname -f -b
+  if _wanted options expl option; then
+    compadd "$expl[@]" -QS '' - -symbols\= -exec\= -se\= -core\= -command\= \
+                                -directory\= -cd\= -tty\=
+    compadd "$expl[@]"        - -help -h -s -e -c -x -d -nx -n -quiet -q \
+	  		        -batch -fullname -f -b
+  fi
 else
   prev="$words[CURRENT-1]"
 
@@ -31,10 +31,10 @@ else
   (-[csx]) _files && return 0 ;;
   (-e)     _description expl executable
            _files "$expl[@]" -g '*(*)' && return 0 ;;
-  (-b)     _description -V expl 'baud rate'
-           compadd "$expl[@]" 0 50 75 110 134 150 200 300 600 1200 1800 \
-			      2400 4800 9600 19200 38400 57600 115200 \
-			      230400 && return 0 ;;
+  (-b)     _wanted values expl -V expl 'baud rate' &&
+               compadd "$expl[@]" 0 50 75 110 134 150 200 300 600 1200 1800 \
+			          2400 4800 9600 19200 38400 57600 115200 \
+			          230400 && return 0 ;;
   esac
 
   w=( "${(@)words[2,-1]}" )
@@ -44,10 +44,7 @@ else
   done
 
   if [[ $#w -gt 1 ]]; then
-    _files               && ret=0
-    _pids -m "${w[1]:t}" && ret=0
-
-    return ret
+    _alternative 'files:: _files' "processes:: _pids -m ${w[1]:t}"
   else
     _description expl executable
     _files "$expl[@]" -g '*(*)'