diff options
author | Ville Skyttä <ville.skytta@iki.fi> | 2009-12-13 11:33:54 +0200 |
---|---|---|
committer | Ville Skyttä <ville.skytta@iki.fi> | 2009-12-13 11:33:54 +0200 |
commit | a358902e90d3acba98ac45a48cdd1d37baad3a04 (patch) | |
tree | a381099ff0a17a3ba055e46e0abf194b9ee7adc4 /bash_completion | |
parent | b72a0f6e26ce5d2cb4253c8095c6ff39af4f08df (diff) | |
download | bash-completion-a358902e90d3acba98ac45a48cdd1d37baad3a04.tar.gz |
Include avahi host completions in known hosts completions no matter if we have known hosts or ssh config files or not.
Diffstat (limited to 'bash_completion')
-rw-r--r-- | bash_completion | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/bash_completion b/bash_completion index 3e65dd6a..66fff101 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 |