Skip to content

Commit

Permalink
ssh: Add -J/ProxyJump completion
Browse files Browse the repository at this point in the history
Supports single jump hosts for now.

Closes #172
  • Loading branch information
scop committed Nov 7, 2017
1 parent 2516a25 commit cc6667e
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions completions/ssh
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ _ssh_options()
HostbasedAuthentication HostKeyAlgorithms HostKeyAlias HostName
IdentityFile IdentitiesOnly IPQoS KbdInteractiveDevices KexAlgorithms
LocalCommand LocalForward LogLevel MACs
NoHostAuthenticationForLocalhost NumberOfPasswordPrompts
NoHostAuthenticationForLocalhost NumberOfPasswordPrompts ProxyJump
PasswordAuthentication PermitLocalCommand PKCS11Provider Port
PreferredAuthentications Protocol ProxyCommand PubkeyAuthentication
RekeyLimit RemoteForward RequestTTY RhostsRSAAuthentication
Expand Down Expand Up @@ -86,6 +86,9 @@ _ssh_suboption()
Cipher)
COMPREPLY=( $( compgen -W 'blowfish des 3des' -- "$cur" ) )
;;
ProxyJump)
_known_hosts_real -a -F "$configfile" -- "$cur"
;;
IPQoS)
COMPREPLY=( $( compgen -W 'af1{1..4} af2{2..3} af3{1..3} af4{1..3}
cs{0..7} ef lowdelay throughput reliability' -- "$cur" ) )
Expand Down Expand Up @@ -159,6 +162,9 @@ _ssh()

local -a config

local configfile
_ssh_configfile

_ssh_suboption_check "$1" && return

case $prev in
Expand All @@ -170,6 +176,10 @@ _ssh()
_ssh_ciphers "$1"
return
;;
-J)
_known_hosts_real -a -F "$configfile" -- "$cur"
return
;;
-m)
_ssh_macs "$1"
return
Expand Down Expand Up @@ -212,8 +222,6 @@ _ssh()
elif [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) )
else
local configfile
_ssh_configfile
_known_hosts_real -a -F "$configfile" -- "$cur"

local args
Expand All @@ -233,6 +241,9 @@ _sftp()
local cur prev words cword
_init_completion || return

local configfile
_ssh_configfile

_ssh_suboption_check && return

case $prev in
Expand Down Expand Up @@ -266,8 +277,6 @@ _sftp()
elif [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) )
else
local configfile
_ssh_configfile
_known_hosts_real -a -F "$configfile" -- "$cur"
fi
} &&
Expand Down Expand Up @@ -344,6 +353,8 @@ _scp()
local cur prev words cword
_init_completion -n : || return

local configfile
_ssh_configfile

_ssh_suboption_check && {
COMPREPLY=( "${COMPREPLY[@]/%/ }" )
Expand Down Expand Up @@ -399,8 +410,6 @@ _scp()
# not a known host, pass through
;;
*)
local configfile
_ssh_configfile
_known_hosts_real -c -a -F "$configfile" -- "$cur"
;;
esac
Expand Down

0 comments on commit cc6667e

Please sign in to comment.