@@ -302,7 +302,7 @@ _comp_cmd_ssh()
302
302
303
303
_comp_cmd_ssh__compgen_suboption_check " $1 " && return
304
304
305
- local ipvx
305
+ local ipvx=
306
306
307
307
# Keep cases sorted the same they're in ssh's usage message
308
308
# (but do group ones with same arg completion)
@@ -459,7 +459,6 @@ _comp_cmd_sftp()
459
459
shopt -u hostcomplete && complete -F _comp_cmd_sftp sftp
460
460
461
461
# things we want to backslash escape in scp paths
462
- # shellcheck disable=SC2089
463
462
_comp_cmd_scp__path_esc=' [][(){}<>"' " '" ' ,:;^&!$=?`\\|[:space:]]'
464
463
465
464
# Complete remote files with ssh. Returns paths escaped with three backslashes
@@ -493,7 +492,6 @@ _comp_xfunc_scp_compgen_remote_files()
493
492
local _path=${cur#*: }
494
493
495
494
# unescape (3 backslashes to 1 for chars we escaped)
496
- # shellcheck disable=SC2090
497
495
_path=$( command sed -e ' s/\\\\\\\(' " $_comp_cmd_scp__path_esc " ' \)/\\\1/g' <<< " $_path" )
498
496
499
497
# default to home dir of specified user on remote host
@@ -509,14 +507,12 @@ _comp_xfunc_scp_compgen_remote_files()
509
507
local _files
510
508
if [[ $_dirs_only ]]; then
511
509
# escape problematic characters; remove non-dirs
512
- # shellcheck disable=SC2090
513
510
_files=$( ssh -o ' Batchmode yes' " $_userhost " \
514
511
command ls -aF1dL " $_path *" 2> /dev/null |
515
512
command sed -e ' s/' " $_comp_cmd_scp__path_esc " ' /' " $_escape_replacement " ' /g' -e ' /[^/]$/d' )
516
513
else
517
514
# escape problematic characters; remove executables, aliases, pipes
518
515
# and sockets; add space at end of file names
519
- # shellcheck disable=SC2090
520
516
_files=$( ssh -o ' Batchmode yes' " $_userhost " \
521
517
command ls -aF1dL " $_path *" 2> /dev/null |
522
518
command sed -e ' s/[*@|=]$//g' \
@@ -539,26 +535,26 @@ _scp_remote_files()
539
535
# @since 2.12
540
536
_comp_xfunc_scp_compgen_local_files ()
541
537
{
542
- local _dirsonly =" "
538
+ local _dirs_only =" "
543
539
if [[ ${1-} == -d ]]; then
544
- _dirsonly =set
540
+ _dirs_only =set
545
541
shift
546
542
fi
547
543
548
544
local files
549
545
_comp_expand_glob files ' "$cur"*' || return 0
550
- if [[ $_dirsonly ]]; then
551
- _comp_compgen -RU files split -l -- " $(
546
+ if [[ $_dirs_only ]]; then
547
+ _comp_compgen -RU files split -l ${1 : +-P " $1 " } -- " $(
552
548
command ls -aF1dL " ${files[@]} " 2> /dev/null |
553
549
command sed -e " s/$_comp_cmd_scp__path_esc /\\\\ &/g" \
554
- -e ' /[^/]$/d' -e " s/^/ ${1-} / "
550
+ -e ' /[^/]$/d'
555
551
) "
556
552
else
557
- _comp_compgen -RU files split -l -- " $(
553
+ _comp_compgen -RU files split -l ${1 : +-P " $1 " } -- " $(
558
554
command ls -aF1dL " ${files[@]} " 2> /dev/null |
559
555
command sed -e ' s/[*@|=]$//g' \
560
556
-e " s/$_comp_cmd_scp__path_esc /\\\\ &/g" \
561
- -e ' s/[^/]$/& /g' -e " s/^/ ${1-} / "
557
+ -e ' s/[^/]$/& /g'
562
558
) "
563
559
fi
564
560
}
@@ -588,7 +584,7 @@ _comp_cmd_scp()
588
584
return
589
585
}
590
586
591
- local ipvx
587
+ local ipvx=
592
588
593
589
case $prev in
594
590
-* c)
@@ -640,7 +636,7 @@ _comp_cmd_scp()
640
636
;;
641
637
esac
642
638
643
- local prefix
639
+ local prefix=
644
640
645
641
if [[ $cur == -F* ]]; then
646
642
cur=${cur# -F}
0 commit comments