File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed
Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -38,6 +38,7 @@ _comp_cmd_cd__compgen_cdpath()
3838 local paths dirs _d
3939 _comp_split -F : paths " $CDPATH "
4040 for _p in " ${paths[@]} " ; do
41+ _p=" ${_p:- .} "
4142 # create an array of matched subdirs
4243 _comp_compgen -v dirs -c " $_p /$cur " -- -d &&
4344 for _d in " ${dirs[@]} " ; do
Original file line number Diff line number Diff line change @@ -51,3 +51,15 @@ def test_cdable_vars_2(self, bash):
5151 bash_env .write_variable ("foo2" , "shared/default" )
5252 completion = assert_complete (bash , "cd f" )
5353 assert completion == ["foo1" , "foo2" ]
54+
55+ @pytest .mark .complete ("cd " , cwd = "shared/default" , env = dict (CDPATH = ":.." ))
56+ def test_cdpath_leading_colon (self , completion ):
57+ assert completion == [
58+ ".ssh/" ,
59+ "bar bar.d/" ,
60+ "bin/" ,
61+ "default/" ,
62+ "empty_dir/" ,
63+ "foo.d/" ,
64+ "ld.so.conf.d/" ,
65+ ]
You can’t perform that action at this time.
0 commit comments