summaryrefslogtreecommitdiff
path: root/completions/gdb
diff options
context:
space:
mode:
authorGabriel F. T. Gomes <gabriel@inconstante.eti.br>2017-09-25 23:46:54 -0300
committerGabriel F. T. Gomes <gabriel@inconstante.eti.br>2017-09-25 23:46:54 -0300
commit6d88f1055806932d9291f96847d2b691cccda2cd (patch)
tree0ff79eedaa8a239331256048981deedbd0721965 /completions/gdb
parent059a87a5936cfebfd2d71ab8057002cafb2ea051 (diff)
downloadbash-completion-6d88f1055806932d9291f96847d2b691cccda2cd.tar.gz
New upstream version 2.7upstream/2.7
Diffstat (limited to 'completions/gdb')
-rw-r--r--completions/gdb15
1 files changed, 12 insertions, 3 deletions
diff --git a/completions/gdb b/completions/gdb
index 125d0b15..75414782 100644
--- a/completions/gdb
+++ b/completions/gdb
@@ -2,9 +2,18 @@
_gdb()
{
- local cur prev words cword
+ local cur prev words cword i
_init_completion || return
+ # gdb [options] --args executable-file [inferior-arguments ...]
+ for (( i=1; i < cword; i++ )); do
+ if [[ "${words[i]}" == --args ]]; then
+ _command_offset $((i+1))
+ return $?
+ fi
+ done
+
+ # gdb [options] [executable-file [core-file or process-id]]
if [[ $cword -eq 1 ]]; then
local IFS
compopt -o filenames
@@ -18,7 +27,7 @@ _gdb()
# names manually.
IFS=":"
local path_array=( $( \
- sed -e 's/:\{2,\}/:/g' -e 's/^://' -e 's/:$//' <<<"$PATH" ) )
+ command sed -e 's/:\{2,\}/:/g' -e 's/^://' -e 's/:$//' <<<"$PATH" ) )
IFS=$'\n'
COMPREPLY=( $( compgen -d -W '$(find "${path_array[@]}" . \
-mindepth 1 -maxdepth 1 -not -type d -executable \
@@ -34,4 +43,4 @@ _gdb()
} &&
complete -F _gdb gdb
-# ex: ts=4 sw=4 et filetype=sh
+# ex: filetype=sh