[Bash-completion-commits] ./current r1134: _known_hosts(): use files from UserKnownHostsFile options in

David Paleino d.paleino at gmail.com
Mon Jun 23 09:28:11 UTC 2008


------------------------------------------------------------
revno: 1134
committer: David Paleino <d.paleino at gmail.com>
branch nick: current
timestamp: Mon 2008-06-23 11:28:11 +0200
message:
  _known_hosts(): use files from UserKnownHostsFile options in 
  addition to standard ones.
modified:
  bash_completion
  debian/changelog
-------------- next part --------------
=== modified file 'bash_completion'
--- a/bash_completion	2008-06-23 09:18:05 +0000
+++ b/bash_completion	2008-06-23 09:28:11 +0000
@@ -2510,33 +2510,29 @@
 	    user_kh=$( eval echo $( sed -ne 's/^[ \t]*[Uu][Ss][Ee][Rr][Kk][Nn][Oo][Ww][Nn][Hh][Oo][Ss][Tt][Ss][Ff][Ii][Ll][Ee]['"$'\t '"']*\(.*\)$/\1/p' "${config[@]}" ) )
 	fi
 
-	# choose which global known hosts file to use
-	if [ -r "$global_kh" ]; then
-	    kh=( "$global_kh" )
-	else
-	    [ -r /etc/ssh/ssh_known_hosts ] &&
-	      kh=( "${kh[@]}" "/etc/ssh/ssh_known_hosts" )
-	    [ -r /etc/ssh/ssh_known_hosts2 ] &&
-	      kh=( "${kh[@]}" "/etc/ssh/ssh_known_hosts2" )
-	    [ -r /etc/known_hosts ] &&
-	      kh=( "${kh[@]}" "/etc/known_hosts" )
-	    [ -r /etc/known_hosts2 ] &&
-	      kh=( "${kh[@]}" "/etc/known_hosts2" )
-	    [ -d /etc/ssh2/knownhosts ] &&
-	      khd=( "${khd[@]}" "/etc/ssh2/knownhosts/*pub" )
-	fi
+	# Global known_hosts files
+	[ -r "$global_kh" ] &&
+		kh=( "${kh[@]}" "$global_kh" )
+	[ -r /etc/ssh/ssh_known_hosts ] &&
+		kh=( "${kh[@]}" /etc/ssh/ssh_known_hosts )
+	[ -r /etc/ssh/ssh_known_hosts2 ] &&
+		kh=( "${kh[@]}" /etc/ssh/ssh_known_hosts2 )
+	[ -r /etc/known_hosts ] &&
+		kh=( "${kh[@]}" /etc/known_hosts )
+	[ -r /etc/known_hosts2 ] &&
+		kh=( "${kh[@]}" /etc/known_hosts2 )
+	[ -d /etc/ssh2/knownhosts ] &&
+		khd=( "${khd[@]}" /etc/ssh2/knownhosts/*pub )
 
-	# choose which user known hosts file to use
-	if [ -r "$user_kh" ]; then
-	    kh=( ${kh[@]} "$user_kh" )
-	else
-	    [ -r "${HOME}/.ssh/known_hosts" ] &&
-	      kh=( "${kh[@]}" "${HOME}/.ssh/known_hosts" )
-	    [ -r "${HOME}/.ssh/known_hosts2" ] &&
-	      kh=( "${kh[@]}" "${HOME}/.ssh/known_hosts2" )
-	    [ -d "${HOME}/.ssh2/hostkeys" ] &&
-	      khd=( "${khd[@]}" "${HOME}/.ssh2/hostkeys/*pub" )
-	fi
+	# User known_hosts files
+	[ -r "$user_kh" ] &&
+		kh=( "${kh[@]}" "$user_kh" )
+	[ -r ~/.ssh/known_hosts" ] &&
+		kh=( "${kh[@]}" ~/.ssh/known_hosts )
+	[ -r ~/.ssh/known_hosts2 ] &&
+		kh=( "${kh[@]}" ~/.ssh/known_hosts2 )
+	[ -d ~/.ssh2/hostkeys ] &&
+		khd=( "${khd[@]}" ~/.ssh2/hostkeys/*pub )
 
 	# If we have known_hosts files to use
 	if [ ${#kh[@]} -gt 0 -o ${#khd[@]} -gt 0 ]; then
@@ -2583,7 +2579,7 @@
 	    fi
 	    # append any available aliases from config files
 	    if [ ${#config[@]} -gt 0 ] && [ -n "$aliases" ]; then
-	    local host_aliases=$( sed -ne 's/^[Hh][Oo][Ss][Tt]\([Nn][Aa][Mm][Ee]\)\?['"$'\t '"']*\([^*?]*\)$/\2/p' "${config[@]}" )
+	    local host_aliases=$( sed -ne 's/^[Hh][Oo][Ss][Tt]\([Nn][Aa][Mm][Ee]\)\?['"$'\t '"']\+\([^*?]*\)$/\2/p' "${config[@]}" )
 	    hosts=$( compgen -W "$host_aliases" -- $ocur )
 		COMPREPLY=( "${COMPREPLY[@]}" $hosts )
 	    fi

=== modified file 'debian/changelog'
--- a/debian/changelog	2008-06-23 09:18:05 +0000
+++ b/debian/changelog	2008-06-23 09:28:11 +0000
@@ -6,8 +6,10 @@
     - refactored _filedir using quote_readline()
     - fixed COMPREPLY's in _iwconfig
     - fixed _cvs()
+    - _known_hosts(): use files from UserKnownHostsFile options in 
+                      addition to standard ones.
 
- -- David Paleino <d.paleino at gmail.com>  Mon, 23 Jun 2008 11:17:54 +0200
+ -- David Paleino <d.paleino at gmail.com>  Mon, 23 Jun 2008 11:26:28 +0200
 
 bash-completion (20080617.3) unstable; urgency=low
 



More information about the Bash-completion-commits mailing list