From ca17fa494b68e92da83ee364bf64b0687006824b Mon Sep 17 00:00:00 2001 From: Kevin K Date: Fri, 3 Apr 2015 11:23:39 -0400 Subject: [PATCH] fix(help): fix spacing when option argument has not long version --- src/app.rs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/app.rs b/src/app.rs index a8411eda38f..d3e1fd18ffd 100644 --- a/src/app.rs +++ b/src/app.rs @@ -508,6 +508,14 @@ impl<'a, 'v, 'ab, 'u, 'ar> App<'a, 'v, 'ab, 'u, 'ar>{ .filter_map(|ref f| if f.long.is_some() {let mult = if f.multiple { 3 } else { 0 }; Some(f.long.unwrap().len() + mult + f.name.len() + 3)}else {None}) { if ol > longest_opt {longest_opt = ol;} } + if longest_opt == 0 { + for ol in self.opts + .values() + .map(|ref f| + f.name.len() + if f.multiple { 3 } else { 0 } + 2 ){ + if ol > longest_opt {longest_opt = ol;} + } + } let mut longest_pos = 0; for pl in self.positionals_idx .values() @@ -649,7 +657,12 @@ impl<'a, 'v, 'ab, 'u, 'ar> App<'a, 'v, 'ab, 'u, 'ar>{ 22=> " ", 23=> " ", 24=> " ", - 25|_=> " " + 25=> " ", + 26=> " ", + 27=> " ", + 28=> " ", + 29=> " ", + 30|_=> " " } } fn print_version(&self, quit: bool) {