From 41a482cf5d9cd4f1bbbff12108ad545a7f820828 Mon Sep 17 00:00:00 2001 From: Kevin K Date: Tue, 10 May 2016 17:01:12 -0400 Subject: [PATCH 1/2] imp(SubCommand Aliases): adds feature to yaml configs too --- src/app/mod.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/app/mod.rs b/src/app/mod.rs index b3db3390..dec9c72d 100644 --- a/src/app/mod.rs +++ b/src/app/mod.rs @@ -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() { for arg_yaml in v { a = a.arg(Arg::from_yaml(&arg_yaml.as_hash().unwrap())); From d4cafcc0fc2e35fae06019b6dde6e51170689a1f Mon Sep 17 00:00:00 2001 From: Kevin K Date: Tue, 10 May 2016 17:05:37 -0400 Subject: [PATCH 2/2] chore: increase version --- CHANGELOG.md | 13 +++++++++++++ Cargo.toml | 2 +- README.md | 15 +++++++++------ 3 files changed, 23 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9d3c4db3..4ba2d386 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,16 @@ + +## 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)) + + ### v2.4.3 (2016-05-10) diff --git a/Cargo.toml b/Cargo.toml index 052ba316..39d00ccc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "clap" -version = "2.4.3" +version = "2.5.0" authors = ["Kevin K. "] exclude = ["examples/*", "clap-test/*", "tests/*", "benches/*", "*.png", "clap-perf/*", "*.dot"] description = "A simple to use, efficient, and full featured Command Line Argument Parser" diff --git a/README.md b/README.md index 668bf6d4..62cce930 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,10 @@ Created by [gh-md-toc](https://github.com/ekalinin/github-markdown-toc) ## 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 * 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. ![clap dependencies](clap_dep_graph.png) - ### More Information 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 -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*: Apologies for the resolution of the first video, it will be updated to a better resolution soon. The other videos have a proper resolution. +**NOTE:** This series is getting out of date and needs to be updated ## 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) ``` -$ cargo test && make -C clap-tests test +$ cargo test + +# If your tests affect the YAML feature set $ cargo test --features yaml # Only on nightly compiler: