@@ -63,7 +63,12 @@ _ssh_options()
63
63
fi
64
64
65
65
compopt -o nospace
66
- COMPREPLY=( $( compgen -S = -W ' ${opts[@]}' -- " $cur " ) )
66
+ local IFS=$' \t\n ' reset=$( shopt -p nocasematch) ; shopt -s nocasematch
67
+ local option
68
+ COMPREPLY=( $( for option in " ${opts[@]} " ; do
69
+ [[ $option == " $cur " * ]] && printf ' %s=\n' " $option "
70
+ done) )
71
+ $reset
67
72
}
68
73
69
74
# Complete a ssh suboption (like ForwardAgent=y<tab>)
@@ -76,85 +81,85 @@ _ssh_suboption()
76
81
# Split into subopt and subval
77
82
local prev=${1%% =* } cur=${1#* =}
78
83
79
- case $prev in
80
- BatchMode|CanonicalDomains|CanonicalizeFallbackLocal |\
81
- ChallengeResponseAuthentication|CheckHostIP |\
82
- ClearAllForwardings|ControlPersist|Compression|EnableSSHKeysign |\
83
- ExitOnForwardFailure|ForwardAgent|ForwardX11|ForwardX11Trusted |\
84
- GatewayPorts|GSSAPIAuthentication|GSSAPIKeyExchange |\
85
- GSSAPIDelegateCredentials|GSSAPIRenewalForcesRekey|GSSAPITrustDns |\
86
- HashKnownHosts|HostbasedAuthentication|IdentitiesOnly |\
87
- KbdInteractiveAuthentication|KbdInteractiveDevices |\
88
- NoHostAuthenticationForLocalhost|PasswordAuthentication |\
89
- ProxyUseFdpass|PubkeyAuthentication|RhostsRSAAuthentication |\
90
- RSAAuthentication|StrictHostKeyChecking|StreamLocalBindUnlink |\
91
- TCPKeepAlive|UsePrivilegedPort|VerifyHostKeyDNS|VisualHostKey )
84
+ case ${ prev,,} in
85
+ batchmode|canonicaldomains|canonicalizefallbacklocal |\
86
+ challengeresponseauthentication|checkhostip |\
87
+ clearallforwardings|controlpersist|compression|enablesshkeysign |\
88
+ exitonforwardfailure|forwardagent|forwardx11|forwardx11trusted |\
89
+ gatewayports|gssapiauthentication|gssapikeyexchange |\
90
+ gssapidelegatecredentials|gssapirenewalforcesrekey|gssapitrustdns |\
91
+ hashknownhosts|hostbasedauthentication|identitiesonly |\
92
+ kbdinteractiveauthentication|kbdinteractivedevices |\
93
+ nohostauthenticationforlocalhost|passwordauthentication |\
94
+ proxyusefdpass|pubkeyauthentication|rhostsrsaauthentication |\
95
+ rsaauthentication|stricthostkeychecking|streamlocalbindunlink |\
96
+ tcpkeepalive|useprivilegedport|verifyhostkeydns|visualhostkey )
92
97
COMPREPLY=( $( compgen -W ' yes no' -- " $cur " ) )
93
98
;;
94
- AddKeysToAgent )
99
+ addkeystoagent )
95
100
COMPREPLY=( $( compgen -W ' yes ask confirm no' -- " $cur " ) )
96
101
;;
97
- AddressFamily )
102
+ addressfamily )
98
103
COMPREPLY=( $( compgen -W ' any inet inet6' -- " $cur " ) )
99
104
;;
100
- BindAddress )
105
+ bindaddress )
101
106
_ip_addresses
102
107
;;
103
- CanonicalizeHostname )
108
+ canonicalizehostname )
104
109
COMPREPLY=( $( compgen -W ' yes no always' -- " $cur " ) )
105
110
;;
106
- * File|IdentityAgent|Include )
111
+ * file|identityagent|include )
107
112
_filedir
108
113
;;
109
- Cipher )
114
+ cipher )
110
115
COMPREPLY=( $( compgen -W ' blowfish des 3des' -- " $cur " ) )
111
116
;;
112
- Ciphers )
117
+ ciphers )
113
118
_ssh_ciphers " $2 "
114
119
;;
115
- CompressionLevel )
120
+ compressionlevel )
116
121
COMPREPLY=( $( compgen -W ' {1..9}' -- " $cur " ) )
117
122
;;
118
- FingerprintHash )
123
+ fingerprinthash )
119
124
COMPREPLY=( $( compgen -W ' md5 sha256' -- " $cur " ) )
120
125
;;
121
- IPQoS )
126
+ ipqos )
122
127
COMPREPLY=( $( compgen -W ' af1{1..4} af2{2..3} af3{1..3} af4{1..3}
123
128
cs{0..7} ef lowdelay throughput reliability' -- " $cur " ) )
124
129
;;
125
- HostbasedKeyTypes|HostKeyAlgorithms )
130
+ hostbasedkeytypes|hostkeyalgorithms )
126
131
COMPREPLY=( $( compgen -W ' $(_ssh_query "$2" key)' -- " $cur " ) )
127
132
;;
128
- KexAlgorithms )
133
+ kexalgorithms )
129
134
COMPREPLY=( $( compgen -W ' $(_ssh_query "$2" kex)' -- " $cur " ) )
130
135
;;
131
- MACs )
136
+ macs )
132
137
_ssh_macs " $2 "
133
138
;;
134
- PreferredAuthentications )
139
+ preferredauthentications )
135
140
COMPREPLY=( $( compgen -W ' gssapi-with-mic host-based publickey
136
141
keyboard-interactive password' -- " $cur " ) )
137
142
;;
138
- Protocol )
143
+ protocol )
139
144
COMPREPLY=( $( compgen -W ' 1 2 1,2 2,1' -- " $cur " ) )
140
145
;;
141
- ProxyJump )
146
+ proxyjump )
142
147
_known_hosts_real -a -F " $configfile " -- " $cur "
143
148
;;
144
- PubkeyAcceptedKeyTypes )
149
+ pubkeyacceptedkeytypes )
145
150
COMPREPLY=( $( compgen -W ' $(_ssh_query "$2" key)' -- " $cur " ) )
146
151
;;
147
- RequestTTY )
152
+ requesttty )
148
153
COMPREPLY=( $( compgen -W ' no yes force auto' -- " $cur " ) )
149
154
;;
150
- SyslogFacility )
155
+ syslogfacility )
151
156
COMPREPLY=( $( compgen -W ' DAEMON USER AUTH LOCAL{0..7}' -- " $cur " ) )
152
157
;;
153
- Tunnel )
158
+ tunnel )
154
159
COMPREPLY=( $( compgen -W ' yes no point-to-point ethernet' \
155
160
-- " $cur " ) )
156
161
;;
157
- UpdateHostKeys )
162
+ updatehostkeys )
158
163
COMPREPLY=( $( compgen -W ' yes no ask' -- " $cur " ) )
159
164
;;
160
165
esac
0 commit comments