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

Freddy Vulto fvulto at gmail.com
Tue Aug 11 19:09:30 UTC 2009


The following commit has been merged in the master branch:
commit 57565c1ce2d7e243aeeda8676b49574a272771fe
Merge: dcc30c71c2186ea0c77c2cfe6b9bf3a998a47e30 ce5384234cc48d523e26f13b1e62d63a725cbcdc
Author: Freddy Vulto <fvulto at gmail.com>
Date:   Tue Aug 11 21:09:19 2009 +0200

    Merge branch 'fvu'

diff --combined bash_completion
index 38fd378,395f4c4..ef34510
--- a/bash_completion
+++ b/bash_completion
@@@ -122,7 -122,7 +122,7 @@@ complete -f -X '!*.@(?(e)ps|?(E)PS|pdf|
  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
  complete -f -X '!*.@(mp3|MP3)' mpg123 mpg321 madplay
 -complete -f -X '!*@(.@(mp?(e)g|MP?(E)G|wma|avi|AVI|asf|vob|VOB|bin|dat|divx|DIVX|vcd|ps|pes|fli|flv|FLV|viv|rm|ram|yuv|mov|MOV|qt|QT|wmv|mp[234]|MP[234]|m4[pv]|M4[PV]|mkv|MKV|ogg|OGG|ogm|OGM|wav|WAV|asx|ASX|mng|MNG|srt|m[eo]d|M[EO]D|s[3t]m|S[3T]M|it|IT|xm|XM)|+([0-9]).@(vdr|VDR))' xine aaxine fbxine kaffeine
 +complete -f -X '!*@(.@(mp?(e)g|MP?(E)G|wma|avi|AVI|asf|vob|VOB|bin|dat|divx|DIVX|vcd|ps|pes|fli|flv|FLV|viv|rm|ram|yuv|mov|MOV|qt|QT|wmv|mp[234]|MP[234]|m4[pv]|M4[PV]|mkv|MKV|og[gmv]|OG[GMV]|wav|WAV|asx|ASX|mng|MNG|srt|m[eo]d|M[EO]D|s[3t]m|S[3T]M|it|IT|xm|XM)|+([0-9]).@(vdr|VDR))' xine aaxine fbxine kaffeine
  complete -f -X '!*.@(avi|asf|wmv)' aviplay
  complete -f -X '!*.@(rm?(j)|ra?(m)|smi?(l))' realplay
  complete -f -X '!*.@(mpg|mpeg|avi|mov|qt)' xanim
@@@ -1152,76 -1152,75 +1152,75 @@@ _known_hosts_real(
  
  	# If we have known_hosts files to use
  	if [ ${#kh[@]} -gt 0 -o ${#khd[@]} -gt 0 -o -n "$configfile" ]; then
- 	    # Escape slashes and dots in paths for awk
- 	    awkcur=${cur//\//\\\/}
- 	    awkcur=${awkcur//\./\\\.}
- 	    curd=$awkcur
- 
- 	    if [[ "$awkcur" == [0-9]*.* ]]; then
- 		# Digits followed by a dot - just search for that
- 		awkcur="^$awkcur.*"
- 	    elif [[ "$awkcur" == [0-9]* ]]; then
- 		# Digits followed by no dot - search for digits followed
- 		# by a dot
- 		awkcur="^$awkcur.*\."
- 	    elif [ -z "$awkcur" ]; then
- 		# A blank - search for a dot or an alpha character
- 		awkcur="[a-z.]"
- 	    else
- 		awkcur="^$awkcur"
- 	    fi
- 
- 	    if [ ${#kh[@]} -gt 0 ]; then
- 
- 		# FS needs to look for a comma separated list
- 		COMPREPLY=( $( awk 'BEGIN {FS=","}
+ 		# Escape slashes and dots in paths for awk
+ 		awkcur=${cur//\//\\\/}
+ 		awkcur=${awkcur//\./\\\.}
+ 		curd=$awkcur
+ 
+ 		if [[ "$awkcur" == [0-9]*.* ]]; then
+ 			# Digits followed by a dot - just search for that
+ 			awkcur="^$awkcur.*"
+ 		elif [[ "$awkcur" == [0-9]* ]]; then
+ 			# Digits followed by no dot - search for digits followed
+ 			# by a dot
+ 			awkcur="^$awkcur.*\."
+ 		elif [ -z "$awkcur" ]; then
+ 			# A blank - search for a dot or an alpha character
+ 			awkcur="[a-z.]"
+ 		else
+ 			awkcur="^$awkcur"
+ 		fi
+ 
+ 		if [ ${#kh[@]} -gt 0 ]; then
+ 			# FS needs to look for a comma separated list
+ 			COMPREPLY=( $( awk 'BEGIN {FS=","}
  				/^\s*[^|\#]/ {for (i=1; i<=2; ++i) { \
  				       gsub(" .*$", "", $i); \
  				       if ($i ~ /'$awkcur'/) {print $i} \
  				}}' "${kh[@]}" 2>/dev/null ) )
- 	    fi
- 	    if [ ${#khd[@]} -gt 0 ]; then
- 		# Needs to look for files called
- 		# .../.ssh2/key_22_<hostname>.pub
- 		# dont fork any processes, because in a cluster environment,
- 		# there can be hundreds of hostkeys
- 		for i in "${khd[@]}" ; do
- 		    if [[ "$i" == *key_22_$awkcurd*.pub ]] && [ -r "$i" ] ; then
- 			host=${i/#*key_22_/}
- 			host=${host/%.pub/}
- 			COMPREPLY=( "${COMPREPLY[@]}" $host )
- 		    fi
+ 		fi
+ 		if [ ${#khd[@]} -gt 0 ]; then
+ 			# Needs to look for files called
+ 			# .../.ssh2/key_22_<hostname>.pub
+ 			# dont fork any processes, because in a cluster environment,
+ 			# there can be hundreds of hostkeys
+ 			for i in "${khd[@]}" ; do
+ 				if [[ "$i" == *key_22_$awkcurd*.pub ]] && [ -r "$i" ] ; then
+ 					host=${i/#*key_22_/}
+ 					host=${host/%.pub/}
+ 					COMPREPLY=( "${COMPREPLY[@]}" $host )
+ 				fi
+ 			done
+ 		fi
+ 		# append any available aliases from config files
+ 		if [ ${#config[@]} -gt 0 ] && [ -n "$aliases" ]; then
+ 			local host_aliases=$( sed -ne 's/^[ \t]*[Hh][Oo][Ss][Tt]\([Nn][Aa][Mm][Ee]\)\?['"$'\t '"']\+\([^#*?]*\)\(#.*\)\?$/\2/p' "${config[@]}" )
+ 			hosts=$( compgen -W "$host_aliases" -- $cur )
+ 				COMPREPLY=( "${COMPREPLY[@]}" $hosts )
+ 		fi
+ 
+ 		# Add hosts reported by avahi, if it's available
+ 		# and if the daemon is started.
+ 		# The original call to avahi-browse also had "-k", to avoid
+ 		#  lookups into avahi's services DB. We don't need the name
+ 		#  of the service, and if it contains ";", it may mistify
+ 		#  the result. But on Gentoo (at least), -k isn't available
+ 		#  (even if mentioned in the manpage), so...
+ 		if type avahi-browse >&/dev/null; then
+ 			if [ -n "$(pidof avahi-daemon)" ]; then
+ 				COMPREPLY=( "${COMPREPLY[@]}" $(
+ 					compgen -W "$( avahi-browse -cpr _workstation._tcp | \
+ 					grep ^= | cut -d\; -f7 | sort -u )" -- $cur ) )
+ 			fi
+ 		fi
+ 
+ 		# Now add results of normal hostname completion
+ 		COMPREPLY=( "${COMPREPLY[@]}" $( compgen -A hostname -- $cur ) )
+ 
+ 		# apply suffix and prefix
+ 		for (( i=0; i < ${#COMPREPLY[@]}; i++ )); do
+ 			COMPREPLY[i]=$prefix$user${COMPREPLY[i]}$suffix
  		done
- 	    fi
- 	    # append any available aliases from config files
- 	    if [ ${#config[@]} -gt 0 ] && [ -n "$aliases" ]; then
- 	    local host_aliases=$( sed -ne 's/^[ \t]*[Hh][Oo][Ss][Tt]\([Nn][Aa][Mm][Ee]\)\?['"$'\t '"']\+\([^#*?]*\)\(#.*\)\?$/\2/p' "${config[@]}" )
- 	    hosts=$( compgen -W "$host_aliases" -- $cur )
- 		COMPREPLY=( "${COMPREPLY[@]}" $hosts )
- 	    fi
- 
-         # Add hosts reported by avahi, if it's available
-         # and if the daemon is started.
-         # The original call to avahi-browse also had "-k", to avoid
-         #  lookups into avahi's services DB. We don't need the name
-         #  of the service, and if it contains ";", it may mistify
-         #  the result. But on Gentoo (at least), -k isn't available
-         #  (even if mentioned in the manpage), so...
-         if type avahi-browse >&/dev/null; then
-             if [ -n "$(pidof avahi-daemon)" ]; then
-                 COMPREPLY=( "${COMPREPLY[@]}" $(
-                     compgen -W "$( avahi-browse -cpr _workstation._tcp | \
-                                    grep ^= | cut -d\; -f7 | sort -u )" -- $cur ) )
-             fi
-         fi
- 
- 	    # Now add results of normal hostname completion
- 	    COMPREPLY=( "${COMPREPLY[@]}" $( compgen -A hostname -- $cur ) )
- 
- 	    # apply suffix and prefix
- 	    for (( i=0; i < ${#COMPREPLY[@]}; i++ )); do
- 		COMPREPLY[i]=$prefix$user${COMPREPLY[i]}$suffix
- 	    done
  	elif [ -z "$configfile" ]; then
  	    # Just do normal hostname completion
  	    COMPREPLY=( $( compgen -A hostname -S "$suffix" -- $cur ) )

-- 
bash-completion



More information about the Bash-completion-commits mailing list