1
1
# ssh(1) completion -*- shell-script -*-
2
2
3
- _comp_xfunc_ssh_query ()
4
- {
5
- _ssh_query " $@ "
6
- }
7
-
8
- _comp_xfunc_ssh_options ()
9
- {
10
- _ssh_options " $@ "
11
- }
12
-
13
- _comp_xfunc_ssh_suboption_check ()
14
- {
15
- _ssh_suboption_check " $@ "
16
- }
17
-
18
- _comp_xfunc_ssh_identityfile ()
19
- {
20
- _ssh_identityfile " $@ "
21
- }
22
-
23
- _comp_xfunc_ssh_scp_remote_files ()
24
- {
25
- _scp_remote_files " $@ "
26
- }
27
-
28
- _comp_xfunc_ssh_scp_local_files ()
29
- {
30
- _scp_local_files " $@ "
31
- }
32
-
33
3
_ssh_queries ()
34
4
{
35
5
local queries=$( _comp_xfunc_ssh_query " $1 " help)
@@ -40,11 +10,13 @@ _ssh_queries()
40
10
COMPREPLY+=($( compgen -W " $queries help" -- " ${cur,,} " ) )
41
11
}
42
12
43
- _ssh_query ()
13
+ _comp_xfunc_ssh_query ()
44
14
{
45
15
${1:- ssh} -Q $2 2> /dev/null
46
16
}
47
17
18
+ _comp_deprecate_func _ssh_query _comp_xfunc_ssh_query
19
+
48
20
_ssh_ciphers ()
49
21
{
50
22
local ciphers=$( _comp_xfunc_ssh_query " $1 " cipher)
@@ -62,7 +34,7 @@ _ssh_macs()
62
34
COMPREPLY+=($( compgen -W " $macs " -- " $cur " ) )
63
35
}
64
36
65
- _ssh_options ()
37
+ _comp_xfunc_ssh_options ()
66
38
{
67
39
# curl --silent https://raw.githubusercontent.com/openssh/openssh-portable/master/ssh_config.5 | awk '$1==".It" && $2=="Cm" && $3!="Host" && $3!="Match" {print " "$3}' | sort
68
40
local opts=(
@@ -111,6 +83,8 @@ _ssh_options()
111
83
$reset
112
84
}
113
85
86
+ _comp_deprecate_func _ssh_options _comp_xfunc_ssh_options
87
+
114
88
# Complete a ssh suboption (like ForwardAgent=y<tab>)
115
89
# Two parameters: the string to complete including the equal sign, and
116
90
# the ssh executable to invoke (optional).
@@ -151,7 +125,7 @@ _ssh_suboption()
151
125
COMPREPLY=($( compgen -W ' yes no always' -- " $cur " ) )
152
126
;;
153
127
identityfile)
154
- _ssh_identityfile
128
+ _comp_xfunc_ssh_identityfile
155
129
;;
156
130
* file | identityagent | include | controlpath | revokedhostkeys | \
157
131
xauthlocation)
@@ -240,7 +214,7 @@ _ssh_suboption()
240
214
# Try to complete -o SubOptions=
241
215
#
242
216
# Returns 0 if the completion was handled or non-zero otherwise.
243
- _ssh_suboption_check ()
217
+ _comp_xfunc_ssh_suboption_check ()
244
218
{
245
219
# Get prev and cur words without splitting on =
246
220
local cureq=$( _get_cword :=) preveq=$( _get_pword :=)
@@ -251,6 +225,8 @@ _ssh_suboption_check()
251
225
return 1
252
226
}
253
227
228
+ _comp_deprecate_func _ssh_suboption_check _comp_xfunc_ssh_suboption_check
229
+
254
230
# Search COMP_WORDS for '-F configfile' or '-Fconfigfile' argument
255
231
_ssh_configfile ()
256
232
{
@@ -271,7 +247,7 @@ _ssh_configfile()
271
247
272
248
# With $1 set, look for public key files, else private
273
249
# shellcheck disable=SC2120
274
- _ssh_identityfile ()
250
+ _comp_xfunc_ssh_identityfile ()
275
251
{
276
252
[[ -z $cur && -d ~ /.ssh ]] && cur=~ /.ssh/id
277
253
_filedir
@@ -281,6 +257,8 @@ _ssh_identityfile()
281
257
fi
282
258
}
283
259
260
+ _comp_deprecate_func _ssh_identityfile _comp_xfunc_ssh_identityfile
261
+
284
262
_ssh ()
285
263
{
286
264
local cur prev words cword
@@ -289,7 +267,7 @@ _ssh()
289
267
local configfile
290
268
_ssh_configfile
291
269
292
- _ssh_suboption_check " $1 " && return
270
+ _comp_xfunc_ssh_suboption_check " $1 " && return
293
271
294
272
local ipvx
295
273
@@ -320,7 +298,7 @@ _ssh()
320
298
return
321
299
;;
322
300
-* i)
323
- _ssh_identityfile
301
+ _comp_xfunc_ssh_identityfile
324
302
return
325
303
;;
326
304
-* J)
@@ -340,7 +318,7 @@ _ssh()
340
318
return
341
319
;;
342
320
-* o)
343
- _ssh_options " $1 "
321
+ _comp_xfunc_ssh_options " $1 "
344
322
return
345
323
;;
346
324
-* Q)
@@ -392,7 +370,7 @@ _sftp()
392
370
local configfile
393
371
_ssh_configfile
394
372
395
- _ssh_suboption_check && return
373
+ _comp_xfunc_ssh_suboption_check && return
396
374
397
375
local ipvx
398
376
@@ -405,7 +383,7 @@ _sftp()
405
383
return
406
384
;;
407
385
-* i)
408
- _ssh_identityfile
386
+ _comp_xfunc_ssh_identityfile
409
387
return
410
388
;;
411
389
-* c)
@@ -417,7 +395,7 @@ _sftp()
417
395
return
418
396
;;
419
397
-* o)
420
- _ssh_options
398
+ _comp_xfunc_ssh_options
421
399
return
422
400
;;
423
401
-* S)
@@ -454,7 +432,7 @@ _scp_path_esc='[][(){}<>"'"'"',:;^&!$=?`\\|[:space:]]'
454
432
# Complete remote files with ssh. If the first arg is -d, complete on dirs
455
433
# only. Returns paths escaped with three backslashes.
456
434
# shellcheck disable=SC2120
457
- _scp_remote_files ()
435
+ _comp_xfunc_ssh_scp_remote_files ()
458
436
{
459
437
local IFS=$' \n '
460
438
@@ -492,11 +470,13 @@ _scp_remote_files()
492
470
COMPREPLY+=($files )
493
471
}
494
472
473
+ _comp_deprecate_func _scp_remote_files _comp_xfunc_ssh_scp_remote_files
474
+
495
475
# This approach is used instead of _filedir to get a space appended
496
476
# after local file/dir completions, and -o nospace retained for others.
497
477
# If first arg is -d, complete on directory names only. The next arg is
498
478
# an optional prefix to add to returned completions.
499
- _scp_local_files ()
479
+ _comp_xfunc_ssh_scp_local_files ()
500
480
{
501
481
local IFS=$' \n '
502
482
@@ -517,6 +497,8 @@ _scp_local_files()
517
497
fi
518
498
}
519
499
500
+ _comp_deprecate_func _scp_local_files _comp_xfunc_ssh_scp_local_files
501
+
520
502
# scp(1) completion
521
503
#
522
504
_scp ()
@@ -527,7 +509,7 @@ _scp()
527
509
local configfile
528
510
_ssh_configfile
529
511
530
- _ssh_suboption_check && {
512
+ _comp_xfunc_ssh_suboption_check && {
531
513
COMPREPLY=(" ${COMPREPLY[@]/%/ } " )
532
514
return
533
515
}
@@ -546,7 +528,7 @@ _scp()
546
528
return
547
529
;;
548
530
-* i)
549
- _ssh_identityfile
531
+ _comp_xfunc_ssh_identityfile
550
532
compopt +o nospace
551
533
return
552
534
;;
@@ -558,7 +540,7 @@ _scp()
558
540
return
559
541
;;
560
542
-* o)
561
- _ssh_options
543
+ _comp_xfunc_ssh_options
562
544
return
563
545
;;
564
546
-* S)
@@ -579,7 +561,7 @@ _scp()
579
561
case $cur in
580
562
! (* :* )/* | [.~]* ) ;; # looks like a path
581
563
* :* )
582
- _scp_remote_files
564
+ _comp_xfunc_ssh_scp_remote_files
583
565
return
584
566
;;
585
567
esac
@@ -607,7 +589,7 @@ _scp()
607
589
esac
608
590
fi
609
591
610
- _scp_local_files " ${prefix-} "
592
+ _comp_xfunc_ssh_scp_local_files " ${prefix-} "
611
593
} &&
612
594
complete -F _scp -o nospace scp
613
595
0 commit comments