Skip to content

Commit f7a8877

Browse files
committed
feat(clap_app!): adds support for arg names with hyphens similar to longs with hyphens
One can now use `("config-file")` style arg names Closes #869
1 parent c83a559 commit f7a8877

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/macros.rs

+7
Original file line numberDiff line numberDiff line change
@@ -597,6 +597,13 @@ macro_rules! app_from_crate {
597597
#[macro_export]
598598
macro_rules! clap_app {
599599
(@app ($builder:expr)) => { $builder };
600+
(@app ($builder:expr) (@arg ($name:expr): $($tail:tt)*) $($tt:tt)*) => {
601+
clap_app!{ @app
602+
($builder.arg(
603+
clap_app!{ @arg ($crate::Arg::with_name($name)) (-) $($tail)* }))
604+
$($tt)*
605+
}
606+
};
600607
(@app ($builder:expr) (@arg $name:ident: $($tail:tt)*) $($tt:tt)*) => {
601608
clap_app!{ @app
602609
($builder.arg(

0 commit comments

Comments
 (0)