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

Ville Skyttä ville.skytta at iki.fi
Sun Dec 13 09:52:34 UTC 2009


The following commit has been merged in the master branch:
commit 5d691d48269e14433aec7e4482b3215ad7e24a14
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Sun Dec 13 11:41:55 2009 +0200

    Complete aliases also when there are no known hosts files (RedHat: #546905).

diff --git a/bash_completion b/bash_completion
index 66fff10..5d8fa22 100644
--- a/bash_completion
+++ b/bash_completion
@@ -1302,7 +1302,7 @@ _known_hosts_real()
     fi
 
     # If we have known_hosts files to use
-    if [[ ${#kh[@]} -gt 0 || ${#khd[@]} -gt 0 || -n "$configfile" ]]; then
+    if [[ ${#kh[@]} -gt 0 || ${#khd[@]} -gt 0 ]]; then
         # Escape slashes and dots in paths for awk
         awkcur=${cur//\//\\\/}
         awkcur=${awkcur//\./\\\.}
@@ -1345,11 +1345,6 @@ _known_hosts_real()
                 fi
             done
         fi
-        # append any available aliases from config files
-        if [[ ${#config[@]} -gt 0 && -n "$aliases" ]]; then
-            local hosts=$( sed -ne 's/^[ \t]*[Hh][Oo][Ss][Tt]\([Nn][Aa][Mm][Ee]\)\?['"$'\t '"']\{1,\}\([^#*?]*\)\(#.*\)\?$/\2/p' "${config[@]}" )
-            COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W "$hosts" -- "$cur" ) )
-        fi
 
         # apply suffix and prefix
         for (( i=0; i < ${#COMPREPLY[@]}; i++ )); do
@@ -1357,6 +1352,13 @@ _known_hosts_real()
         done
     fi
 
+    # append any available aliases from config files
+    if [[ ${#config[@]} -gt 0 && -n "$aliases" ]]; then
+        local hosts=$( sed -ne 's/^[ \t]*[Hh][Oo][Ss][Tt]\([Nn][Aa][Mm][Ee]\)\?['"$'\t '"']\{1,\}\([^#*?]*\)\(#.*\)\?$/\2/p' "${config[@]}" )
+        COMPREPLY=( "${COMPREPLY[@]}" $( compgen  -P "$prefix$user" \
+            -S "$suffix" -W "$hosts" -- "$cur" ) )
+    fi
+
     # Add hosts reported by avahi-browse, if it's available.
     # 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

-- 
bash-completion



More information about the Bash-completion-commits mailing list