Skip to content

Commit 0f927c0

Browse files
committed
refactor(ssh): _comp_cmd_ssh__suboption signature to convention
1 parent 56a7cec commit 0f927c0

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

completions/ssh

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,14 @@ _comp_xfunc_ssh_options()
8989
_comp_deprecate_func 2.12 _ssh_options _comp_xfunc_ssh_options
9090

9191
# 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
9494
# Not all suboptions are completed.
9595
# Doesn't handle comma-separated lists.
9696
_comp_cmd_ssh__suboption()
9797
{
9898
# Split into subopt and subval
99-
local prev=${1%%=*} cur=${1#*=}
99+
local prev=${2%%=*} cur=${2#*=}
100100

101101
case ${prev,,} in
102102
batchmode | canonicaldomains | canonicalizefallbacklocal | \
@@ -135,13 +135,13 @@ _comp_cmd_ssh__suboption()
135135
_comp_compgen_filedir
136136
;;
137137
casignaturealgorithms)
138-
COMPREPLY=($(compgen -W '$(_comp_xfunc_ssh_query "$2" sig)' -- "$cur"))
138+
COMPREPLY=($(compgen -W '$(_comp_xfunc_ssh_query "$1" sig)' -- "$cur"))
139139
;;
140140
cipher)
141141
_comp_compgen -- -W 'blowfish des 3des'
142142
;;
143143
ciphers)
144-
_comp_cmd_ssh__ciphers "$2"
144+
_comp_cmd_ssh__ciphers "$1"
145145
;;
146146
controlmaster)
147147
_comp_compgen -- -W 'yes ask auto autoask no'
@@ -157,16 +157,16 @@ _comp_cmd_ssh__suboption()
157157
cs{0..7} ef lowdelay throughput reliability'
158158
;;
159159
hostbasedkeytypes | hostkeyalgorithms)
160-
COMPREPLY=($(compgen -W '$(_comp_xfunc_ssh_query "$2" key)' -- "$cur"))
160+
COMPREPLY=($(compgen -W '$(_comp_xfunc_ssh_query "$1" key)' -- "$cur"))
161161
;;
162162
kexalgorithms)
163-
COMPREPLY=($(compgen -W '$(_comp_xfunc_ssh_query "$2" kex)' -- "$cur"))
163+
COMPREPLY=($(compgen -W '$(_comp_xfunc_ssh_query "$1" kex)' -- "$cur"))
164164
;;
165165
loglevel)
166166
_comp_compgen -- -W 'QUIET FATAL ERROR INFO VERBOSE DEBUG{,1,2,3}'
167167
;;
168168
macs)
169-
_comp_cmd_ssh__macs "$2"
169+
_comp_cmd_ssh__macs "$1"
170170
;;
171171
pkcs11provider)
172172
_comp_compgen_filedir so
@@ -176,7 +176,7 @@ _comp_cmd_ssh__suboption()
176176
keyboard-interactive password' -- "$cur"))
177177
;;
178178
protocol)
179-
local protocols=($(_comp_xfunc_ssh_query "$2" protocol-version))
179+
local protocols=($(_comp_xfunc_ssh_query "$1" protocol-version))
180180
[[ $protocols ]] || protocols=(1 2)
181181
if ((${#protocols[@]} > 1)); then
182182
_comp_compgen -- -W '"${protocols[@]}"'
@@ -189,7 +189,7 @@ _comp_cmd_ssh__suboption()
189189
_comp_compgen -- -c
190190
;;
191191
pubkeyacceptedalgorithms | pubkeyacceptedkeytypes)
192-
COMPREPLY=($(compgen -W '$(_comp_xfunc_ssh_query "$2" key)' -- "$cur"))
192+
COMPREPLY=($(compgen -W '$(_comp_xfunc_ssh_query "$1" key)' -- "$cur"))
193193
;;
194194
requesttty)
195195
_comp_compgen -- -W 'no yes force auto'
@@ -221,7 +221,7 @@ _comp_xfunc_ssh_suboption_check()
221221
local cur prev
222222
_comp_get_words -n := cur prev
223223
if [[ $cur == *=* && $prev == -*o ]]; then
224-
_comp_cmd_ssh__suboption "$cur" "${1-}"
224+
_comp_cmd_ssh__suboption "${1:-ssh}" "$cur"
225225
return $?
226226
fi
227227
return 1

0 commit comments

Comments
 (0)