The following commit has been merged in the master branch:
commit 5d691d48269e14433aec7e4482b3215ad7e24a14
Author: Ville Skyttä <[email protected]>
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 [[ ${#...@]} -gt 0 || ${#k...@]} -gt 0 || -n "$configfile" ]]; then
+    if [[ ${#...@]} -gt 0 || ${#k...@]} -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 [[ ${#conf...@]} -gt 0 && -n "$aliases" ]]; then
-            local hosts=$( sed -ne 's/^[ 
\t]*[Hh][Oo][Ss][Tt]\([Nn][Aa][Mm][Ee]\)\?['"$'\t 
'"']\{1,\}\([^#*?]*\)\(#.*\)\?$/\2/p' "${conf...@]}" )
-            COMPREPLY=( "${comprep...@]}" $( compgen -W "$hosts" -- "$cur" ) )
-        fi
 
         # apply suffix and prefix
         for (( i=0; i < ${#comprep...@]}; i++ )); do
@@ -1357,6 +1352,13 @@ _known_hosts_real()
         done
     fi
 
+    # append any available aliases from config files
+    if [[ ${#conf...@]} -gt 0 && -n "$aliases" ]]; then
+        local hosts=$( sed -ne 's/^[ 
\t]*[Hh][Oo][Ss][Tt]\([Nn][Aa][Mm][Ee]\)\?['"$'\t 
'"']\{1,\}\([^#*?]*\)\(#.*\)\?$/\2/p' "${conf...@]}" )
+        COMPREPLY=( "${comprep...@]}" $( 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

_______________________________________________
Bash-completion-commits mailing list
[email protected]
http://lists.alioth.debian.org/mailman/listinfo/bash-completion-commits

Reply via email to