diff --git a/clap_complete/src/engine/complete.rs b/clap_complete/src/engine/complete.rs index 64cdea89..9ed091b8 100644 --- a/clap_complete/src/engine/complete.rs +++ b/clap_complete/src/engine/complete.rs @@ -447,7 +447,11 @@ fn shorts_and_visible_aliases(p: &clap::Command) -> Vec { a.get_short_and_visible_aliases().map(|shorts| { shorts.into_iter().map(|s| { CompletionCandidate::new(s.to_string()) - .help(a.get_help().cloned()) + .help( + a.get_help() + .cloned() + .or_else(|| a.get_long().map(|long| format!("--{long}").into())), + ) .id(Some(format!("arg::{}", a.get_id()))) .hide(a.is_hide_set()) }) diff --git a/clap_complete/tests/testsuite/engine.rs b/clap_complete/tests/testsuite/engine.rs index 50ce9247..59a5a64d 100644 --- a/clap_complete/tests/testsuite/engine.rs +++ b/clap_complete/tests/testsuite/engine.rs @@ -1114,8 +1114,8 @@ pos-c assert_data_eq!( complete!(cmd, "-[TAB]"), snapbox::str![[r#" --r --o +-r --required-flag +-o --optional-flag -s -h Print help --long-flag