mirror of
https://github.com/clap-rs/clap
synced 2024-12-14 14:52:33 +00:00
fix(complete): Have shorts fallback to using long as description
It should be rare that this is helpful
This commit is contained in:
parent
8af051c439
commit
cd6280fc87
2 changed files with 7 additions and 3 deletions
|
@ -447,7 +447,11 @@ fn shorts_and_visible_aliases(p: &clap::Command) -> Vec<CompletionCandidate> {
|
|||
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())
|
||||
})
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue