Skip to content

Commit 24bd420

Browse files
committed
fix(cd): fix cdable_vars overwritten by another generator
1 parent 68e65b8 commit 24bd420

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

completions/cd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ _comp_cmd_cd()
7272

7373
compopt -o filenames
7474
_comp_cmd_cd__compgen_cdable_vars
75-
_comp_cmd_cd__compgen_cdpath
75+
_comp_compgen -ai cd cdpath
7676
_comp_compgen -a filedir -d
7777
}
7878
complete -F _comp_cmd_cd -o nospace cd pushd

test/t/test_cd.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,12 @@ def test_cdable_vars(self, bash):
4242
bash_env.write_variable("foo6", "shared/default/bar")
4343
completion = assert_complete(bash, "cd f")
4444
assert completion == ["foo1", "foo2"]
45+
46+
def test_cdable_vars_2(self, bash):
47+
with bash_env_saved(bash) as bash_env:
48+
bash_env.write_variable("CDPATH", "nonexistent")
49+
bash_env.shopt("cdable_vars", True)
50+
bash_env.write_variable("foo1", "shared")
51+
bash_env.write_variable("foo2", "shared/default")
52+
completion = assert_complete(bash, "cd f")
53+
assert completion == ["foo1", "foo2"]

0 commit comments

Comments
 (0)