Skip to content

Commit

Permalink
fix(complete): Allow completing '.'
Browse files Browse the repository at this point in the history
  • Loading branch information
epage committed Aug 21, 2024
1 parent eded64a commit 84252b7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions clap_complete/src/engine/custom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,10 @@ pub(crate) fn complete_path(
};
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)
.ok()
.into_iter()
Expand Down
1 change: 1 addition & 0 deletions clap_complete/tests/testsuite/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,7 @@ fn suggest_value_path_dir() {
assert_data_eq!(
complete!(cmd, "--input [TAB]", current_dir = Some(testdir_path)),
snapbox::str![[r#"
.
c_dir/
d_dir/
"#]],
Expand Down

0 comments on commit 84252b7

Please sign in to comment.