Skip to content

Commit 898fed7

Browse files
committed
refactor(scp): use "_comp_compgen_split -P" to add prefix
1 parent 5c932ee commit 898fed7

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

completions/ssh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -544,17 +544,17 @@ _comp_xfunc_scp_compgen_local_files()
544544
local files
545545
_comp_expand_glob files '"$cur"*' || return 0
546546
if [[ $_dirsonly ]]; then
547-
_comp_compgen -RU files split -l -- "$(
547+
_comp_compgen -RU files split -l ${1:+-P "$1"} -- "$(
548548
command ls -aF1dL "${files[@]}" 2>/dev/null |
549549
command sed -e "s/$_comp_cmd_scp__path_esc/\\\\&/g" \
550-
-e '/[^/]$/d' -e "s/^/${1-}/"
550+
-e '/[^/]$/d'
551551
)"
552552
else
553-
_comp_compgen -RU files split -l -- "$(
553+
_comp_compgen -RU files split -l ${1:+-P "$1"} -- "$(
554554
command ls -aF1dL "${files[@]}" 2>/dev/null |
555555
command sed -e 's/[*@|=]$//g' \
556556
-e "s/$_comp_cmd_scp__path_esc/\\\\&/g" \
557-
-e 's/[^/]$/& /g' -e "s/^/${1-}/"
557+
-e 's/[^/]$/& /g'
558558
)"
559559
fi
560560
}

0 commit comments

Comments
 (0)