[Bash-completion-commits] [SCM] bash-completion branch, master, updated. a66323a18fd48b56e9d036e7e76638ad896c4ec0

David Paleino d.paleino at gmail.com
Tue Apr 14 19:41:22 UTC 2009


The following commit has been merged in the master branch:
commit a66323a18fd48b56e9d036e7e76638ad896c4ec0
Merge: 204afd77bfebb0d8a70821d1d6ccdd85ef6b54f5 baa1aa3afd2d2b8398fa7366b8d32a389217d4f3
Author: David Paleino <d.paleino at gmail.com>
Date:   Tue Apr 14 21:41:15 2009 +0200

    Merge branch 'master' of git+ssh://git.debian.org/git/bash-completion/bash-completion

diff --combined CHANGES
index 83d94b9,5d30f0f..78e8d76
--- a/CHANGES
+++ b/CHANGES
@@@ -29,6 -29,9 +29,9 @@@ bash-completion (1.x
    * Rename installed_alternatives() to _installed_alternatives().
    * Add /etc/pki/tls/openssl.cnf to list of default openssl config files,
      search for default ones only if -config is not given.
+   * Use POSIX compliant arguments to tail in mkisofs completion.
+   * Protect various completions from unusual user input by not embedding the
+     input in external command arguments.
  
    [ Todd Zullinger ]
    * Make yum complete on filenames after install, deplist, update and upgrade
@@@ -43,9 -46,6 +46,9 @@@
    [ Raphaël Droz ]
    * Add mount -L and -U completion.
  
 +  [ Philipp Weis ]
 +  * Add .dvi.{gz,bz2} completion for evince/okular (Debian: #522656)
 +
   -- David Paleino <d.paleino at gmail.com>  Wed, 25 Mar 2009 23:18:24 +0100
  
  bash-completion (1.0)
diff --combined bash_completion
index c217a9f,bf562af..b01eba5
--- a/bash_completion
+++ b/bash_completion
@@@ -110,7 -110,7 +110,7 @@@ complete -f -X '!*.@(dvi|DVI)?(.@(gz|Z|
  complete -f -X '!*.@(dvi|DVI)' dvips dviselect dvitype dvipdf advi dvipdfm dvipdfmx
  complete -f -X '!*.@(pdf|PDF)' acroread gpdf xpdf
  complete -f -X '!*.@(?(e)ps|?(E)PS|pdf|PDF)' kpdf
 -complete -f -X '!*.@(@(?(e)ps|?(E)PS|pdf|PDF)?(.gz|.GZ|.bz2|.BZ2)|cb[rz]|CB[RZ]|djv?(u)|DJV?(U)|dvi|DVI|gif|jp?(e)g|miff|tif?(f)|pn[gm]|p[bgp]m|bmp|xpm|ico|xwd|tga|pcx|GIF|JP?(E)G|MIFF|TIF?(F)|PN[GM]|P[BGP]M|BMP|XPM|ICO|XWD|TGA|PCX)' evince okular
 +complete -f -X '!*.@(@(?(e)ps|?(E)PS|pdf|PDF|dvi|DVI)?(.gz|.GZ|.bz2|.BZ2)|cb[rz]|CB[RZ]|djv?(u)|DJV?(U)|dvi|DVI|gif|jp?(e)g|miff|tif?(f)|pn[gm]|p[bgp]m|bmp|xpm|ico|xwd|tga|pcx|GIF|JP?(E)G|MIFF|TIF?(F)|PN[GM]|P[BGP]M|BMP|XPM|ICO|XWD|TGA|PCX)' evince okular
  complete -f -X '!*.@(?(e)ps|?(E)PS|pdf|PDF)' ps2pdf ps2pdf12 ps2pdf13 ps2pdf14 ps2pdfwr
  complete -f -X '!*.texi*' makeinfo texi2html
  complete -f -X '!*.@(?(la)tex|?(LA)TEX|texi|TEXI|dtx|DTX|ins|INS)' tex latex slitex jadetex pdfjadetex pdftex pdflatex texi2dvi
@@@ -375,7 -375,7 +375,7 @@@ _configured_interfaces(
  #
  _kernel_versions()
  {
- 	COMPREPLY=( $( command ls /lib/modules | grep "^$cur" ) )
+ 	COMPREPLY=( $( compgen -W '$( command ls /lib/modules )' -- $cur ) )
  }
  
  # This function completes on all available network interfaces
@@@ -475,14 -475,12 +475,12 @@@ _pnames(
  _uids()
  {
  	if type getent &>/dev/null; then
- 	    COMPREPLY=( $( getent passwd | \
- 			    awk -F: '{if ($3 ~ /^'$cur'/) print $3}' ) )
+ 	    COMPREPLY=( $( compgen -W '$( getent passwd | cut -d: -f3 )' -- $cur ) )
  	elif type perl &>/dev/null; then
  	    COMPREPLY=( $( compgen -W '$( perl -e '"'"'while (($uid) = (getpwent)[2]) { print $uid . "\n" }'"'"' )' -- $cur ) )
  	else
  	    # make do with /etc/passwd
- 	    COMPREPLY=( $( awk 'BEGIN {FS=":"} {if ($3 ~ /^'$cur'/) print $3}'\
- 			    /etc/passwd ) )
+ 	    COMPREPLY=( $( compgen -W '$( cut -d: -f3 /etc/passwd )' -- $cur ) )
  	fi
  }
  
@@@ -710,8 -708,8 +708,8 @@@ _complete(
  			return 0
  			;;
  		-@(p|r))
- 			COMPREPLY=( $( complete -p | sed -e 's|.* ||' | \
- 					grep "^$cur" ) )
+ 			COMPREPLY=( $( complete -p | sed -e 's|.* ||' ) )
+ 			COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- $cur ) )
  			return 0
  			;;
  
@@@ -877,12 -875,10 +875,10 @@@ _mount(
  		fi
  	elif [ -r /etc/vfstab ]; then
  		# Solaris
- 		COMPREPLY=( $( awk '! /^[ \t]*#/ {if ($3 ~ /\//) print $3}' \
- 				/etc/vfstab | grep "^$cur" ) )
+ 		COMPREPLY=( $( compgen -W "$( awk '! /^[ \t]*#/ {if ($3 ~ /\//) print $3}' /etc/vfstab )" -- $cur ) )
  	elif [ ! -e /etc/fstab ]; then
  		# probably Cygwin
- 		COMPREPLY=( $( mount | awk '! /^[ \t]*#/ {if ($3 ~ /\//) print $3}' \
- 				 | grep "^$cur" ) )
+ 		COMPREPLY=( $( compgen -W "$( mount | awk '! /^[ \t]*#/ {if ($3 ~ /\//) print $3}' )" -- $cur ) )
  	else
  		# probably Linux
  		if [ $prev = -L ]; then
@@@ -890,8 -886,7 +886,7 @@@
  		elif [ $prev = -U ]; then
  			COMPREPLY=( $( compgen -W '$(sed -ne "s/^[[:space:]]*UUID=\([^[:space:]]*\).*/\1/p" /etc/fstab )' -- $cur ) )
  		else
- 			COMPREPLY=( $( awk '! /^[ \t]*#/ {if ($2 ~ /\//) print $2}' \
- 				/etc/fstab | grep "^$cur" ) )
+ 			COMPREPLY=( $( compgen -W "$( awk '! /^[ \t]*#/ {if ($2 ~ /\//) print $2}' /etc/fstab )" -- $cur ) )
  		fi
  	fi
  
@@@ -1147,8 -1142,7 +1142,7 @@@ _find(
  	-fstype)
  		# this is highly non-portable
  		[ -e /proc/filesystems ] &&
- 		COMPREPLY=( $( cut -d$'\t' -f 2 /proc/filesystems | \
- 				grep "^$cur" ) )
+ 		COMPREPLY=( $( compgen -W "$( cut -d$'\t' -f2 /proc/filesystems )" -- $cur ) )
  		return 0
  		;;
  	-gid)
@@@ -5240,7 -5234,7 +5234,7 @@@ _installed_alternatives(
  			break
  		fi
  	done
- 	COMPREPLY=( $( command ls $admindir | grep "^$cur" ) )
+ 	COMPREPLY=( $( compgen -W '$( command ls $admindir )' -- $cur ) )
  }
  
  _update_alternatives()
@@@ -6114,8 -6108,8 +6108,8 @@@ _mkisofs(
  			return 0
  			;;
  		-*-charset)
- 			COMPREPLY=( $( mkisofs -input-charset help 2>&1 | \
- 					tail +3 | grep "^$cur") )
+ 			COMPREPLY=( $( compgen -W '$( mkisofs -input-charset \
+ 					help 2>&1 | tail -n +3 )' -- $cur ) )
  			return 0
  			;;
  		-uid)
@@@ -6270,10 -6264,10 +6264,10 @@@ _ImageMagick(
  			return 0
  			;;
  		-format)
- 			COMPREPLY=( $( convert -list format | \
+ 			COMPREPLY=( $( compgen -W "$( convert -list format | \
  				    awk '/ [r-][w-][+-] / {print $1}' | \
- 				    tr -d '*' | tr [:upper:] [:lower:] | \
- 				    grep "^$cur" ) )
+ 				    tr -d '*' | tr [:upper:] [:lower:] )" \
+ 				    -- $cur ) )
  			return 0
  			;;
  		-gravity)
@@@ -6791,7 -6785,7 +6785,7 @@@ _cancel(
  	COMPREPLY=()
  	cur=`_get_cword`
  
- 	COMPREPLY=( $( lpstat | cut -d' ' -f1 | grep "^$cur" ) )
+ 	COMPREPLY=( $( compgen -W "$( lpstat | cut -d' ' -f1 )" -- $cur ) )
  } &&
  complete -F _cancel $filenames cancel
  
@@@ -8150,8 -8144,8 +8144,8 @@@ _pkg_config(
  		      --list-all --debug --print-errors --silence-errors \
  		      --errors-to-stdout -? --help --usage' -- $cur))
  	else
- 		COMPREPLY=( $( pkg-config --list-all 2>/dev/null | \
- 				    awk '{print $1}' | grep "^$cur" ) )
+ 		COMPREPLY=( $( compgen -W "$( pkg-config --list-all \
+ 				2>/dev/null | awk '{print $1}' )" -- $cur ) )
  	fi
  } &&
  complete -F _pkg_config pkg-config

-- 
bash-completion



More information about the Bash-completion-commits mailing list