Skip to content

Commit

Permalink
fix: fixes a bug where positional argument help text is misaligned
Browse files Browse the repository at this point in the history
  • Loading branch information
kbknapp committed May 11, 2017
1 parent c556b39 commit 54c1683
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/args/arg_builder/positional.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ impl<'n, 'e> Display for PosBuilder<'n, 'e> {
} else {
try!(write!(f, "<{}>", self.b.name));
}
if self.b.settings.is_set(ArgSettings::Multiple) && self.v.val_names.is_none() {
if self.b.settings.is_set(ArgSettings::Multiple) && (self.v.val_names.is_none() || self.v.val_names.as_ref().unwrap().len() == 1) {
try!(write!(f, "..."));
}

Expand Down
8 changes: 4 additions & 4 deletions tests/help.rs
Original file line number Diff line number Diff line change
Expand Up @@ -398,8 +398,8 @@ OPTIONS:
-t, --timeout <SECONDS> Timeout in seconds. By default, there is no timeout.
ARGS:
<BINFILE> The path of the binary to be profiled. If empty, Cargo.toml is searched for a binary.
<ARGS>... Any arguments you wish to pass to the binary being profiled.";
<BINFILE> The path of the binary to be profiled. for a binary.
<ARGS>... Any arguments you wish to pass to the being profiled.";

static LAST_ARG_REQ_MULT: &'static str = "example 1.0
Expand Down Expand Up @@ -501,12 +501,12 @@ fn args_with_last_usage() {
.takes_value(true)
)
.arg(Arg::with_name("binary path")
.help("The path of the binary to be profiled. If empty, Cargo.toml is searched for a binary.")
.help("The path of the binary to be profiled. for a binary.")
.takes_value(true)
.value_name("BINFILE")
)
.arg(Arg::with_name("pass through args")
.help("Any arguments you wish to pass to the binary being profiled.")
.help("Any arguments you wish to pass to the being profiled.")
.value_name("ARGS")
.last(true)
.multiple(true)
Expand Down

0 comments on commit 54c1683

Please sign in to comment.