fix(complete): Allow completing '.'

This commit is contained in:
Ed Page 2024-08-21 15:06:46 -05:00
parent eded64a13b
commit 84252b7123
2 changed files with 5 additions and 0 deletions

View file

@ -259,6 +259,10 @@ pub(crate) fn complete_path(
}; };
debug!("complete_path: search_root={search_root:?}, prefix={prefix:?}"); debug!("complete_path: search_root={search_root:?}, prefix={prefix:?}");
if value_os.is_empty() && is_wanted(&search_root) {
completions.push(".".into());
}
for entry in std::fs::read_dir(&search_root) for entry in std::fs::read_dir(&search_root)
.ok() .ok()
.into_iter() .into_iter()

View file

@ -639,6 +639,7 @@ fn suggest_value_path_dir() {
assert_data_eq!( assert_data_eq!(
complete!(cmd, "--input [TAB]", current_dir = Some(testdir_path)), complete!(cmd, "--input [TAB]", current_dir = Some(testdir_path)),
snapbox::str![[r#" snapbox::str![[r#"
.
c_dir/ c_dir/
d_dir/ d_dir/
"#]], "#]],