Skip to content

Commit

Permalink
ssh, scp, sftp: Support completing arg of last bundled short option
Browse files Browse the repository at this point in the history
  • Loading branch information
scop committed May 23, 2018
1 parent f499aa3 commit 645d901
Showing 1 changed file with 37 additions and 28 deletions.
65 changes: 37 additions & 28 deletions completions/ssh
Original file line number Diff line number Diff line change
Expand Up @@ -199,53 +199,56 @@ _ssh()
local ipvx

case $prev in
-4|-6)
ipvx=$prev
-*4*)
ipvx=-4
;;
-b)
-*6*)
ipvx=-6
;;
-*b)
_ip_addresses
return
;;
-c)
-*c)
_ssh_ciphers "$1"
return
;;
-D|-e|-L|-p|-R|-W)
-*[DeLpRW])
return
;;
-E|-F|-i|-S)
-*[EFiS])
_filedir
return
;;
-I)
-*I)
_filedir so
return
;;
-J)
-*J)
_known_hosts_real -a -F "$configfile" -- "$cur"
return
;;
-l)
-*l)
COMPREPLY=( $( compgen -u -- "$cur" ) )
return
;;
-m)
-*m)
_ssh_macs "$1"
return
;;
-O)
-*O)
COMPREPLY=( $( compgen -W 'check forward exit stop' -- "$cur" ) )
return
;;
-o)
-*o)
_ssh_options
return
;;
-Q)
-*Q)
_ssh_queries "$1"
return
;;
-w)
-*w)
_available_interfaces
return
;;
Expand Down Expand Up @@ -287,25 +290,28 @@ _sftp()
local ipvx

case $prev in
-4|-6)
ipvx=$prev
-*4*)
ipvx=-4
;;
-*6*)
ipvx=-6
;;
-B|-D|-l|-P|-R|-s)
-*[BDlPRs])
return
;;
-b|-F|-i)
-*[bFi])
_filedir
return
;;
-c)
-*c)
_ssh_ciphers
return
;;
-o)
-*o)
_ssh_options
return
;;
-S)
-*S)
_command
return
;;
Expand Down Expand Up @@ -407,27 +413,30 @@ _scp()
local ipvx

case $prev in
-4|-6)
ipvx=$prev
-*4*)
ipvx=-4
;;
-*6*)
ipvx=-6
;;
-c)
-*c)
_ssh_ciphers
COMPREPLY=( "${COMPREPLY[@]/%/ }" )
return
;;
-F|-i)
-*[Fi])
_filedir
compopt +o nospace
return
;;
-l|-P)
-*[lP])
return
;;
-o)
-*o)
_ssh_options
return
;;
-S)
-*S)
_command
compopt +o nospace
return
Expand Down

0 comments on commit 645d901

Please sign in to comment.