mirror of
https://github.com/clap-rs/clap
synced 2024-12-13 22:32:33 +00:00
fix(help): fix formatting for option arguments with no long
This commit is contained in:
parent
1da0905b11
commit
e869100423
1 changed files with 3 additions and 3 deletions
|
@ -549,19 +549,19 @@ impl<'a, 'v, 'ab, 'u, 'ar> App<'a, 'v, 'ab, 'u, 'ar>{
|
|||
format!("{}--{}=",
|
||||
if v.short.is_some() {", "} else {""},l)
|
||||
} else {
|
||||
"".to_owned()
|
||||
" ".to_owned()
|
||||
},
|
||||
format!("{}{}", v.name, if v.multiple{"..."} else {""}),
|
||||
if v.long.is_some() {
|
||||
self.get_spaces((longest_opt + 4) - (v.long.unwrap().len() + v.name.len() + 2 + mult))
|
||||
} else {
|
||||
// 7 is '--=' (3) + tab (4)
|
||||
self.get_spaces(longest_opt + 7)
|
||||
self.get_spaces((longest_opt + 6) - (v.name.len() + mult))
|
||||
},
|
||||
if let Some(h) = v.help {
|
||||
format!("{}{}", h,
|
||||
if let Some(ref pv) = v.possible_vals {
|
||||
format!(" [values:{}]", pv.iter().fold(String::new(), |acc, name| acc + &format!("{}",name)[..] ))
|
||||
format!(" [values:{}]", pv.iter().fold(String::new(), |acc, name| acc + &format!(" {}",name)[..] ))
|
||||
}else{
|
||||
"".to_owned()
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue