[Bash-completion-commits] ./current r1161: * Improving _gdb completion:
David Paleino
d.paleino at gmail.com
Wed Jun 25 19:18:12 UTC 2008
------------------------------------------------------------
revno: 1161
committer: David Paleino <d.paleino at gmail.com>
branch nick: current
timestamp: Wed 2008-06-25 21:18:12 +0200
message:
* Improving _gdb completion:
- do not complete Bash's builtins (thanks to Morita Sho)
modified:
bash_completion
debian/changelog
-------------- next part --------------
=== modified file 'bash_completion'
--- a/bash_completion 2008-06-25 17:59:26 +0000
+++ b/bash_completion 2008-06-25 19:18:12 +0000
@@ -4045,7 +4045,22 @@
prev=${COMP_WORDS[COMP_CWORD-1]}
if [ $COMP_CWORD -eq 1 ]; then
- COMPREPLY=( $( PATH="$PATH:." compgen -d -c -- "$cur" ) )
+ local IFS
+ if [[ "$cur" == */* ]]; then
+ # compgen -c works as expected if $cur contains any slashes.
+ IFS=$'\n'
+ COMPREPLY=( $( PATH="$PATH:." compgen -d -c -- "$cur" ) )
+ else
+ # otherwise compgen -c contains Bash's built-in commands,
+ # functions and aliases. Thus we need to retrieve the program
+ # names manually.
+ IFS=":"
+ local path_array=( $(echo "$PATH") )
+ IFS=$'\n'
+ COMPREPLY=( $( compgen -d -W '$(find "${path_array[@]}" . \
+ -mindepth 1 -maxdepth 1 -not -type d -executable -printf "%f\\n")' \
+ -- "$cur" ) )
+ fi
elif [ $COMP_CWORD -eq 2 ]; then
prev=${prev##*/}
COMPREPLY=( $( compgen -fW "$( command ps axo comm,pid | \
=== modified file 'debian/changelog'
--- a/debian/changelog 2008-06-25 17:59:26 +0000
+++ b/debian/changelog 2008-06-25 19:18:12 +0000
@@ -3,12 +3,13 @@
* Added more completions to imagemagick (thanks to Nelson A. de
Oliveira) (Closes: #487786)
* Added xrandr completion (thanks to Anton Khirnov) (Closes: #487825)
- * Changing _gdb completion:
+ * Improving _gdb completion:
- $filenames to $default (Closes: #463969)
- also show directory names (i.e. compgen -d) in COMPREPLY.
- added . to $PATH, to allow debugging "local" executables.
+ - do not complete Bash's builtins (thanks to Morita Sho)
- -- David Paleino <d.paleino at gmail.com> Wed, 25 Jun 2008 19:59:03 +0200
+ -- David Paleino <d.paleino at gmail.com> Wed, 25 Jun 2008 21:17:23 +0200
bash-completion (20080617.5) unstable; urgency=medium
More information about the Bash-completion-commits
mailing list