Use the usual (local) $prev and $cur in _ssh_suboption.

This commit is contained in:
Ville Skyttä 2009-12-24 15:57:43 +02:00
parent b56e45eaac
commit 7c4de4a3ca

View File

@ -7,13 +7,14 @@ _ssh_ciphers()
{ {
COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W '3des-cbc aes128-cbc \ COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W '3des-cbc aes128-cbc \
aes192-cbc aes256-cbc aes128-ctr aes192-ctr aes256-ctr arcfour128 \ aes192-cbc aes256-cbc aes128-ctr aes192-ctr aes256-ctr arcfour128 \
arcfour256 arcfour blowfish-cbc cast128-cbc' -- "$1" ) ) arcfour256 arcfour blowfish-cbc cast128-cbc' -- "$cur" ) )
} }
_ssh_macs() _ssh_macs()
{ {
COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W 'hmac-md5 hmac-sha1 \ COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W 'hmac-md5 hmac-sha1 \
umac-64@openssh.com hmac-ripemd160 hmac-sha1-96 hmac-md5-96' -- "$1" ) ) umac-64@openssh.com hmac-ripemd160 hmac-sha1-96 hmac-md5-96' \
-- "$cur" ) )
} }
_ssh_options() _ssh_options()
@ -45,9 +46,9 @@ _ssh_options()
_ssh_suboption() _ssh_suboption()
{ {
# Split into subopt and subval # Split into subopt and subval
local subopt=${1%%=*} subval=${1#*=} local prev=${1%%=*} cur=${1#*=}
case "$subopt" in case "$prev" in
BatchMode|ChallengeResponseAuthentication|CheckHostIP|\ BatchMode|ChallengeResponseAuthentication|CheckHostIP|\
ClearAllForwardings|Compression|ExitOnForwardFailure|ForwardAgent|\ ClearAllForwardings|Compression|ExitOnForwardFailure|ForwardAgent|\
ForwardX11|ForwardX11Trusted|GatewayPorts|GSSAPIAuthentication|\ ForwardX11|ForwardX11Trusted|GatewayPorts|GSSAPIAuthentication|\
@ -58,31 +59,30 @@ _ssh_suboption()
PubkeyAuthentication|RhostsRSAAuthentication|RSAAuthentication|\ PubkeyAuthentication|RhostsRSAAuthentication|RSAAuthentication|\
StrictHostKeyChecking|TCPKeepAlive|UsePrivilegedPort|\ StrictHostKeyChecking|TCPKeepAlive|UsePrivilegedPort|\
VerifyHostKeyDNS|VisualHostKey) VerifyHostKeyDNS|VisualHostKey)
COMPREPLY=( $( compgen -W 'yes no' -- "$subval") ) COMPREPLY=( $( compgen -W 'yes no' -- "$cur") )
;; ;;
AddressFamily) AddressFamily)
COMPREPLY=( $( compgen -W 'any inet inet6' -- "$subval" ) ) COMPREPLY=( $( compgen -W 'any inet inet6' -- "$cur" ) )
;; ;;
Cipher) Cipher)
COMPREPLY=( $( compgen -W 'blowfish des 3des' -- "$subval" ) ) COMPREPLY=( $( compgen -W 'blowfish des 3des' -- "$cur" ) )
;; ;;
Protocol) Protocol)
COMPREPLY=( $( compgen -W '1 2 1,2 2,1' -- "$subval" ) ) COMPREPLY=( $( compgen -W '1 2 1,2 2,1' -- "$cur" ) )
;; ;;
Tunnel) Tunnel)
COMPREPLY=( $( compgen -W 'yes no point-to-point ethernet' \ COMPREPLY=( $( compgen -W 'yes no point-to-point ethernet' \
-- "$subval" ) ) -- "$cur" ) )
;; ;;
PreferredAuthentications) PreferredAuthentications)
COMPREPLY=( $( compgen -W 'gssapi-with-mic host-based \ COMPREPLY=( $( compgen -W 'gssapi-with-mic host-based \
publickey keyboard-interactive password' \ publickey keyboard-interactive password' -- "$cur" ) )
-- "$subval" ) )
;; ;;
MACs) MACs)
_ssh_macs "$subval" _ssh_macs
;; ;;
Ciphers) Ciphers)
_ssh_ciphers "$subval" _ssh_ciphers
;; ;;
esac esac
return 0 return 0
@ -119,11 +119,11 @@ _ssh()
return 0 return 0
;; ;;
-c) -c)
_ssh_ciphers "$cur" _ssh_ciphers
return 0 return 0
;; ;;
-m) -m)
_ssh_macs "$cur" _ssh_macs
return 0 return 0
;; ;;
-l) -l)