Merge pull request #502 from kbknapp/v2.5.0

V2.5.0
This commit is contained in:
Kevin K 2016-05-10 19:26:44 -04:00
commit 57c8777062
4 changed files with 30 additions and 7 deletions

View file

@ -1,3 +1,16 @@
<a name="v2.5.0"></a>
## v2.5.0 (2016-05-10)
#### Improvements
* **SubCommand Aliases:** adds feature to yaml configs too ([69592195](https://github.com/kbknapp/clap-rs/commit/695921954dde46dfd483399dcdef482c9dd7f34a))
#### Features
* **SubCommands:** adds support for subcommand aliases ([66b4dea6](https://github.com/kbknapp/clap-rs/commit/66b4dea65c44d8f77ff522238a9237aed1bcab6d), closes [#469](https://github.com/kbknapp/clap-rs/issues/469))
<a name="v2.4.3"></a> <a name="v2.4.3"></a>
### v2.4.3 (2016-05-10) ### v2.4.3 (2016-05-10)

View file

@ -1,7 +1,7 @@
[package] [package]
name = "clap" name = "clap"
version = "2.4.3" version = "2.5.0"
authors = ["Kevin K. <kbknapp@gmail.com>"] authors = ["Kevin K. <kbknapp@gmail.com>"]
exclude = ["examples/*", "clap-test/*", "tests/*", "benches/*", "*.png", "clap-perf/*", "*.dot"] exclude = ["examples/*", "clap-test/*", "tests/*", "benches/*", "*.png", "clap-perf/*", "*.dot"]
description = "A simple to use, efficient, and full featured Command Line Argument Parser" description = "A simple to use, efficient, and full featured Command Line Argument Parser"

View file

@ -38,6 +38,10 @@ Created by [gh-md-toc](https://github.com/ekalinin/github-markdown-toc)
## What's New ## What's New
Here's what's new in v.2.5.0
* Subcommands now support aliases - think of them as hidden subcommands that dispatch to said subcommand automatically
Here's what's new in v2.4.3 Here's what's new in v2.4.3
* Bug Fixes * Bug Fixes
@ -499,7 +503,6 @@ The following graphic depicts `clap`s dependency graph (generated using [cargo-g
* **Blue** Color: Dev dependency, only used while developing. * **Blue** Color: Dev dependency, only used while developing.
![clap dependencies](clap_dep_graph.png) ![clap dependencies](clap_dep_graph.png)
### More Information ### More Information
You can find complete documentation on the [github-pages site](http://kbknapp.github.io/clap-rs/clap/index.html) for this project. You can find complete documentation on the [github-pages site](http://kbknapp.github.io/clap-rs/clap/index.html) for this project.
@ -508,11 +511,9 @@ You can also find usage examples in the [examples/](examples) directory of this
#### Video Tutorials #### Video Tutorials
There's also the video tutorial series [Argument Parsing with Rust](https://www.youtube.com/playlist?list=PLza5oFLQGTl0Bc_EU_pBNcX-rhVqDTRxv) that I've been working on. There's also the video tutorial series [Argument Parsing with Rust](https://www.youtube.com/playlist?list=PLza5oFLQGTl0Bc_EU_pBNcX-rhVqDTRxv).
*Note*: Two new videos have just been added ([08 From Usage](https://youtu.be/xc6VdedFrG0), and [09 Typed Values](https://youtu.be/mZn3C1DnD90)), if you're already familiar with `clap` but want to know more about these two details you can check out those videos without watching the previous few. **NOTE:** This series is getting out of date and needs to be updated
*Note*: Apologies for the resolution of the first video, it will be updated to a better resolution soon. The other videos have a proper resolution.
## How to Contribute ## How to Contribute
@ -527,7 +528,9 @@ Please read [CONTRIBUTING.md](.github/CONTRIBUTING.md) before you start contribu
If contributing, you can run the tests as follows (assuming you're in the `clap-rs` directory) If contributing, you can run the tests as follows (assuming you're in the `clap-rs` directory)
``` ```
$ cargo test && make -C clap-tests test $ cargo test
# If your tests affect the YAML feature set
$ cargo test --features yaml $ cargo test --features yaml
# Only on nightly compiler: # Only on nightly compiler:

View file

@ -974,6 +974,13 @@ impl<'a> From<&'a Yaml> for App<'a, 'a> {
} }
} }
} }
if let Some(v) = yaml["aliases"].as_vec() {
for ys in v {
if let Some(s) = ys.as_str() {
a = a.alias(s);
}
}
}
if let Some(v) = yaml["args"].as_vec() { if let Some(v) = yaml["args"].as_vec() {
for arg_yaml in v { for arg_yaml in v {
a = a.arg(Arg::from_yaml(&arg_yaml.as_hash().unwrap())); a = a.arg(Arg::from_yaml(&arg_yaml.as_hash().unwrap()));