[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 1.3-279-gf815736

Ville Skyttä ville.skytta at iki.fi
Tue May 10 21:44:53 UTC 2011


The following commit has been merged in the master branch:
commit f815736ffe110ee079bc9d0f37394cd3c3e8ad33
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Wed May 11 00:35:16 2011 +0300

    gdb: Improve filename completion.
    
    Only core files where appropriate, turn on -o filenames, drop -o default.

diff --git a/completions/gdb b/completions/gdb
index 6bd32ad..1d3489b 100644
--- a/completions/gdb
+++ b/completions/gdb
@@ -27,12 +27,14 @@ _gdb()
                 -printf "%f\\n" 2>/dev/null)' -- "$cur" ) )
         fi
     elif [ $cword -eq 2 ]; then
-        prev=${prev##*/}
-        COMPREPLY=( $( compgen -fW "$( command ps axo comm,pid | \
-            awk '{if ($1 ~ /^'"$prev"'/) print $2}' )" -- "$cur" ) )
+        COMPREPLY=( $( compgen -W "$( command ps axo comm,pid | \
+            awk '{if ($1 ~ /^'"${prev##*/}"'/) print $2}' )" -- "$cur" ) )
+        compopt -o filenames
+        COMPREPLY+=( $( compgen -f -X '!?(*/)core?(.+([0-9]))' -o plusdirs \
+            -- "$cur" ) )
     fi
 } &&
-complete -F _gdb -o default gdb
+complete -F _gdb gdb
 
 # Local variables:
 # mode: shell-script

-- 
bash-completion



More information about the Bash-completion-commits mailing list