Skip to content

Commit 7aeb047

Browse files
committed
refactor(scp): use "_comp_compgen_split -P" to add prefix
1 parent 661e1e7 commit 7aeb047

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

completions/ssh

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -543,17 +543,16 @@ _comp_xfunc_scp_compgen_local_files()
543543
local files
544544
_comp_expand_glob files '"$cur"*' || return 0
545545
if [[ $_dirsonly ]]; then
546-
_comp_compgen -RU files split -l -- "$(
546+
_comp_compgen -RU files split -l ${1:+-P "$1"} -- "$(
547547
command ls -aF1dL "${files[@]}" 2>/dev/null |
548548
command sed -e "s/$_comp_cmd_scp__path_esc/\\\\&/g" \
549-
-e '/[^/]$/d' -e "s/^/${1-}/"
549+
-e '/[^/]$/d'
550550
)"
551551
else
552-
_comp_compgen -RU files split -l -- "$(
552+
_comp_compgen -RU files split -l ${1:+-P "$1"} -- "$(
553553
command ls -aF1dL "${files[@]}" 2>/dev/null |
554554
command sed -e "s/$_comp_cmd_scp__path_esc/\\\\&/g" \
555-
-e 's/[*@]$//g' -e 's/\\[|=]$//g' \
556-
-e 's/[^/]$/& /g' -e "s/^/${1-}/"
555+
-e 's/[*@]$//g' -e 's/\\[|=]$//g' -e 's/[^/]$/& /g'
557556
)"
558557
fi
559558
}

0 commit comments

Comments
 (0)