Skip to content

Commit

Permalink
feat(clap_app!): adds support for arg names with hyphens similar to l…
Browse files Browse the repository at this point in the history
…ongs with hyphens

One can now use `("config-file")` style arg names

Closes #869
  • Loading branch information
kbknapp committed Apr 5, 2017
1 parent c83a559 commit f7a8877
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -597,6 +597,13 @@ macro_rules! app_from_crate {
#[macro_export]
macro_rules! clap_app {
(@app ($builder:expr)) => { $builder };
(@app ($builder:expr) (@arg ($name:expr): $($tail:tt)*) $($tt:tt)*) => {
clap_app!{ @app
($builder.arg(
clap_app!{ @arg ($crate::Arg::with_name($name)) (-) $($tail)* }))
$($tt)*
}
};
(@app ($builder:expr) (@arg $name:ident: $($tail:tt)*) $($tt:tt)*) => {
clap_app!{ @app
($builder.arg(
Expand Down

0 comments on commit f7a8877

Please sign in to comment.