summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVille Skyttä <ville.skytta@iki.fi>2015-12-25 14:56:22 +0200
committerVille Skyttä <ville.skytta@iki.fi>2015-12-25 14:56:22 +0200
commitf8f6ffa72ed3db9c6628b50f1bd3ef9582b4f264 (patch)
tree281be8fae41c6e02f44a0e01171ec86655383325
parent5fd00776c49f1d4552630c986e70f21e4a6028ad (diff)
downloadbash-completion-f8f6ffa72ed3db9c6628b50f1bd3ef9582b4f264.tar.gz
ssh: Avoid completing commands before hostname
This isn't a complete fix as preceding options with arguments will trip _count_args, but it's better than previously.
-rw-r--r--completions/ssh5
1 files changed, 4 insertions, 1 deletions
diff --git a/completions/ssh b/completions/ssh
index f3380e72..9a8e0c6d 100644
--- a/completions/ssh
+++ b/completions/ssh
@@ -210,7 +210,10 @@ _ssh()
shift
done
_known_hosts_real -a -F "$configfile" "$cur"
- if [[ $cword -ne 1 ]]; then
+
+ local args
+ _count_args
+ if [[ $args -gt 1 ]]; then
compopt -o filenames
COMPREPLY+=( $( compgen -c -- "$cur" ) )
fi