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

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


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

    Include avahi host completions in known hosts completions no matter if we have known hosts or ssh config files or not.

diff --git a/bash_completion b/bash_completion
index 3e65dd6..66fff10 100644
--- a/bash_completion
+++ b/bash_completion
@@ -1351,25 +1351,24 @@ _known_hosts_real()
             COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W "$hosts" -- "$cur" ) )
         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
-            COMPREPLY=( "${COMPREPLY[@]}" $(
-            compgen -W "$( avahi-browse -cpr _workstation._tcp 2>/dev/null | \
-            grep ^= | cut -d\; -f7 | sort -u )" -- "$cur" ) )
-        fi
-
         # apply suffix and prefix
         for (( i=0; i < ${#COMPREPLY[@]}; i++ )); do
             COMPREPLY[i]=$prefix$user${COMPREPLY[i]}$suffix
         done
     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
+    # 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
+        COMPREPLY=( "${COMPREPLY[@]}" $( \
+            compgen -P "$prefix$user" -S "$suffix" -W \
+            "$( avahi-browse -cpr _workstation._tcp 2>/dev/null | \
+                 grep ^= | cut -d\; -f7 | sort -u )" -- "$cur" ) )
+    fi
+
     # Add results of normal hostname completion, unless
     # `COMP_KNOWN_HOSTS_WITH_HOSTFILE' is set to an empty value.
     if [ -n "${COMP_KNOWN_HOSTS_WITH_HOSTFILE-1}" ]; then

-- 
bash-completion



More information about the Bash-completion-commits mailing list