Skip to content

Commit 84252b7

Browse files
committed
fix(complete): Allow completing '.'
1 parent eded64a commit 84252b7

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

clap_complete/src/engine/custom.rs

+4
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,10 @@ pub(crate) fn complete_path(
259259
};
260260
debug!("complete_path: search_root={search_root:?}, prefix={prefix:?}");
261261

262+
if value_os.is_empty() && is_wanted(&search_root) {
263+
completions.push(".".into());
264+
}
265+
262266
for entry in std::fs::read_dir(&search_root)
263267
.ok()
264268
.into_iter()

clap_complete/tests/testsuite/engine.rs

+1
Original file line numberDiff line numberDiff line change
@@ -639,6 +639,7 @@ fn suggest_value_path_dir() {
639639
assert_data_eq!(
640640
complete!(cmd, "--input [TAB]", current_dir = Some(testdir_path)),
641641
snapbox::str![[r#"
642+
.
642643
c_dir/
643644
d_dir/
644645
"#]],

0 commit comments

Comments
 (0)