diff --git a/clap_complete/src/engine/custom.rs b/clap_complete/src/engine/custom.rs index 10c15f3806c..51da696fefe 100644 --- a/clap_complete/src/engine/custom.rs +++ b/clap_complete/src/engine/custom.rs @@ -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() diff --git a/clap_complete/tests/testsuite/engine.rs b/clap_complete/tests/testsuite/engine.rs index 6f4d4fd5d0d..a4211183902 100644 --- a/clap_complete/tests/testsuite/engine.rs +++ b/clap_complete/tests/testsuite/engine.rs @@ -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/ "#]],