Skip to content

Commit

Permalink
Auto merge of #762 - kbknapp:issue-threedots, r=kbknapp
Browse files Browse the repository at this point in the history
Issue threedots
  • Loading branch information
homu committed Dec 2, 2016
2 parents 12a5f6e + 56bd25a commit b225cdb
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 10 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
<a name="v2.19.1"></a>
### v2.19.1 (2016-12-01)


#### Bug Fixes

* **Help Messages:** fixes help message alignment when specific settings are used on options ([cd94b318](https://github.com/kbknapp/clap-rs/commit/cd94b3188d63b63295a319e90e826bca46befcd2), closes [#760](https://github.com/kbknapp/clap-rs/issues/760))

#### Improvements

* **Bash Completion:** allows bash completion to fall back to traidtional bash completion upon no matching completing function ([b1b16d56](https://github.com/kbknapp/clap-rs/commit/b1b16d56d8fddf819bdbe24b3724bb6a9f3fa613)))


<a name="v2.19.0"></a>
## v2.19.0 (2016-11-21)

Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]

name = "clap"
version = "2.19.0"
version = "2.19.1"
authors = ["Kevin K. <kbknapp@gmail.com>"]
exclude = ["examples/*", "clap-test/*", "tests/*", "benches/*", "*.png", "clap-perf/*", "*.dot"]
repository = "https://github.com/kbknapp/clap-rs.git"
Expand Down
16 changes: 7 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,20 +45,18 @@ Created by [gh-md-toc](https://github.com/ekalinin/github-markdown-toc)

## What's New

Here's the highlights for v2.19.0
Here's the highlights for v2.19.1

* **Help Messages:** fixes help message alignment when specific settings are used on options
* **Bash Completion:** allows bash completion to fall back to traidtional bash completion upon no matching completing function


Here's the highlights from v2.0.0 to v2.19.0

* **Arg Setting**: Allows specifying an `AllowLeadingHyphen` style setting for values only for specific args, vice command wide
* **Validators:** improves the error messages for validators
* Updates the docs landing page
* Adds the macro version back to the readme
* Fixes some broken docs links
* **Compatibility Policy:** adds an official compatibility policy to
* **Contributing:** updates the readme to improve the readability and contributing sections
* **Required Unless:** fixes a bug where having required_unless set doesn't work when conflicts are also set
* **ZSH Completions:** fixes an issue where zsh completions caused panics if there were no subcommands

Here's the highlights from v2.0.0 to v2.18.0

* **Completions:** Adds completion support for Microsoft PowerShell! (Thanks to @Arnavion)
* Allows specifying the second to last positional argument as `multiple(true)` (i.e. things such as `mv <files>... <target>`)
* Adds an `App::get_name` and `App::get_bin_name`
Expand Down
3 changes: 3 additions & 0 deletions src/args/arg_builder/option.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ impl<'n, 'e> Display for OptBuilder<'n, 'e> {
try!(write!(f, " "));
}
}
if self.is_set(ArgSettings::Multiple) && num == 1 {
try!(write!(f, "..."));
}
} else {
try!(write!(f,
"<{}>{}",
Expand Down
33 changes: 33 additions & 0 deletions tests/help.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,20 @@ OPTIONS:
ARGS:
<scpositional> tests positionals";

// Using number_of_values(1) with multiple(true) misaligns help message
static ISSUE_760: &'static str = "ctest 0.1
USAGE:
ctest [OPTIONS]
FLAGS:
-h, --help Prints help information
-V, --version Prints version information
OPTIONS:
-O, --opt <opt> tests options
-o, --option <option>... tests options";

static MULTI_SC_HELP: &'static str = "ctest-subcmd-multi 0.1
Kevin K. <kbknapp@gmail.com>
tests subcommands
Expand Down Expand Up @@ -453,4 +467,23 @@ fn issue_702_multiple_values() {
.multiple(true)
.takes_value(true));
test::check_err_output(app, "myapp --help", ISSUE_702, false);
}

#[test]
fn issue_760() {
let app = App::new("ctest")
.version("0.1")
.arg(Arg::with_name("option")
.help("tests options")
.short("o")
.long("option")
.takes_value(true)
.multiple(true)
.number_of_values(1))
.arg(Arg::with_name("opt")
.help("tests options")
.short("O")
.long("opt")
.takes_value(true));
test::check_err_output(app, "ctest --help", ISSUE_760, false);
}

0 comments on commit b225cdb

Please sign in to comment.