[Bash-completion-devel] Bug#504547: bash-completion: perl -I/-x completion improvements
Freddy Vulto
fvulto at gmail.com
Wed Nov 5 00:20:29 UTC 2008
Package: bash-completion
Version: 20080705
Severity: normal
When completion perl options -I or -x:
- spaces in directory names aren't honoured
- with `perl -I<space><tab>', completions are falsely prefixed with -I resulting in an additional `-I' appended to the commandline: `perl -I -I'
- with `perl -I<space><tab>' a slash is added to directory names, whereas with `perl -I<tab>' no slash is added
- with `perl -I<tab>' an additional space is added after each directory name completion, making it difficult to assemble a path using completion
Attached diff addresses these problems.
Regards,
Freddy Vulto
-- System Information:
Debian Release: 4.0
APT prefers stable
APT policy: (500, 'stable')
Architecture: i386 (i686)
Shell: /bin/sh linked to /bin/bash
Kernel: Linux 2.6.18-6-686
Locale: LANG=en_US, LC_CTYPE=en_US (charmap=ISO-8859-1)
-------------- next part --------------
=== modified file 'bash_completion'
--- bash_completion 2008-11-01 11:32:22 +0000
+++ bash_completion 2008-11-04 23:00:35 +0000
@@ -5294,27 +5294,30 @@
_perl()
{
- local cur prev prefix temp
+ local cur optPrefix optSuffix prev prefix temp
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
prefix=""
- # completing an option (may or may not be separated by a space)
+ # If option not followed by whitespace, reassign prev and cur
if [[ "$cur" == -?* ]]; then
temp=$cur
prev=${temp:0:2}
cur=${temp:2}
+ optPrefix=-P$prev
+ optSuffix=-S/
prefix=$prev
fi
# only handle module completion for now
case "$prev" in
- -I|-x)
- COMPREPLY=( $( compgen -d -P "$prev" -- "$cur" ) )
- return 0
- ;;
+ -I|-x)
+ local IFS=$'\t\n'
+ COMPREPLY=( $( compgen -d $optPrefix $optSuffix -- "$cur" ) )
+ return 0
+ ;;
-m|-M)
_perlmodules
return 0
@@ -5332,7 +5335,7 @@
-n -a -F -l -0 -I -m -M -P -S -x -i -e ' -- $cur ) )
return 0
}
-complete -F _perl $filenames perl
+complete -F _perl $nospace $filenames perl
_perldoc()
{
More information about the Bash-completion-devel
mailing list