Skip to content

fix(scp): fix a bug that -F<prefix>[TAB] did not complete at all #1396

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions completions/ssh
Original file line number Diff line number Diff line change
Expand Up @@ -547,13 +547,13 @@ _comp_xfunc_scp_compgen_local_files()
local files
_comp_expand_glob files '"$cur"*' || return 0
if [[ $_dirsonly ]]; then
_comp_compgen -U files split -l -- "$(
_comp_compgen -RU files split -l -- "$(
command ls -aF1dL "${files[@]}" 2>/dev/null |
command sed -e "s/$_comp_cmd_scp__path_esc/\\\\&/g" \
-e '/[^\/]$/d' -e "s/^/${1-}/"
)"
else
_comp_compgen -U files split -l -- "$(
_comp_compgen -RU files split -l -- "$(
command ls -aF1dL "${files[@]}" 2>/dev/null |
command sed -e "s/$_comp_cmd_scp__path_esc/\\\\&/g" \
-e 's/[*@|=]$//g' -e 's/[^\/]$/& /g' -e "s/^/${1-}/"
Expand Down
8 changes: 8 additions & 0 deletions test/t/test_scp.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,14 @@ def test_capital_f_without_space(self, completion):
"option requires an argument -- F" in x for x in completion
)

@pytest.mark.complete("scp -Fconf", cwd="scp")
def test_capital_f_without_space_2(self, completion):
assert completion == "ig"

@pytest.mark.complete("scp -Fbi", cwd="scp")
def test_capital_f_without_space_3(self, completion):
assert completion == "n/"

@pytest.fixture(scope="class")
def live_pwd(self, bash):
try:
Expand Down
Loading