@@ -89,14 +89,14 @@ _comp_xfunc_ssh_options()
89
89
_comp_deprecate_func 2.12 _ssh_options _comp_xfunc_ssh_options
90
90
91
91
# Complete a ssh suboption (like ForwardAgent=y<tab>)
92
- # Two parameters: the string to complete including the equal sign, and
93
- # the ssh executable to invoke (optional).
92
+ # @param $1 the ssh executable to invoke
93
+ # @param $2 the string to complete including the equal sign
94
94
# Not all suboptions are completed.
95
95
# Doesn't handle comma-separated lists.
96
96
_comp_cmd_ssh__suboption ()
97
97
{
98
98
# Split into subopt and subval
99
- local prev=${1 %% =* } cur=${1 #* =}
99
+ local prev=${2 %% =* } cur=${2 #* =}
100
100
101
101
case ${prev,,} in
102
102
batchmode | canonicaldomains | canonicalizefallbacklocal | \
@@ -135,13 +135,13 @@ _comp_cmd_ssh__suboption()
135
135
_comp_compgen_filedir
136
136
;;
137
137
casignaturealgorithms)
138
- COMPREPLY=($( compgen -W ' $(_comp_xfunc_ssh_query "$2 " sig)' -- " $cur " ) )
138
+ COMPREPLY=($( compgen -W ' $(_comp_xfunc_ssh_query "$1 " sig)' -- " $cur " ) )
139
139
;;
140
140
cipher)
141
141
_comp_compgen -- -W ' blowfish des 3des'
142
142
;;
143
143
ciphers)
144
- _comp_cmd_ssh__ciphers " $2 "
144
+ _comp_cmd_ssh__ciphers " $1 "
145
145
;;
146
146
controlmaster)
147
147
_comp_compgen -- -W ' yes ask auto autoask no'
@@ -157,16 +157,16 @@ _comp_cmd_ssh__suboption()
157
157
cs{0..7} ef lowdelay throughput reliability'
158
158
;;
159
159
hostbasedkeytypes | hostkeyalgorithms)
160
- COMPREPLY=($( compgen -W ' $(_comp_xfunc_ssh_query "$2 " key)' -- " $cur " ) )
160
+ COMPREPLY=($( compgen -W ' $(_comp_xfunc_ssh_query "$1 " key)' -- " $cur " ) )
161
161
;;
162
162
kexalgorithms)
163
- COMPREPLY=($( compgen -W ' $(_comp_xfunc_ssh_query "$2 " kex)' -- " $cur " ) )
163
+ COMPREPLY=($( compgen -W ' $(_comp_xfunc_ssh_query "$1 " kex)' -- " $cur " ) )
164
164
;;
165
165
loglevel)
166
166
_comp_compgen -- -W ' QUIET FATAL ERROR INFO VERBOSE DEBUG{,1,2,3}'
167
167
;;
168
168
macs)
169
- _comp_cmd_ssh__macs " $2 "
169
+ _comp_cmd_ssh__macs " $1 "
170
170
;;
171
171
pkcs11provider)
172
172
_comp_compgen_filedir so
@@ -176,7 +176,7 @@ _comp_cmd_ssh__suboption()
176
176
keyboard-interactive password' -- " $cur " ) )
177
177
;;
178
178
protocol)
179
- local protocols=($( _comp_xfunc_ssh_query " $2 " protocol-version) )
179
+ local protocols=($( _comp_xfunc_ssh_query " $1 " protocol-version) )
180
180
[[ $protocols ]] || protocols=(1 2)
181
181
if (( ${# protocols[@]} > 1 )) ; then
182
182
_comp_compgen -- -W ' "${protocols[@]}"'
@@ -189,7 +189,7 @@ _comp_cmd_ssh__suboption()
189
189
_comp_compgen -- -c
190
190
;;
191
191
pubkeyacceptedalgorithms | pubkeyacceptedkeytypes)
192
- COMPREPLY=($( compgen -W ' $(_comp_xfunc_ssh_query "$2 " key)' -- " $cur " ) )
192
+ COMPREPLY=($( compgen -W ' $(_comp_xfunc_ssh_query "$1 " key)' -- " $cur " ) )
193
193
;;
194
194
requesttty)
195
195
_comp_compgen -- -W ' no yes force auto'
@@ -221,7 +221,7 @@ _comp_xfunc_ssh_suboption_check()
221
221
local cur prev
222
222
_comp_get_words -n := cur prev
223
223
if [[ $cur == * = * && $prev == -* o ]]; then
224
- _comp_cmd_ssh__suboption " $cur " " ${1-} "
224
+ _comp_cmd_ssh__suboption " ${1 :- ssh} " " $cur "
225
225
return $?
226
226
fi
227
227
return 1
0 commit comments