mirror of
https://github.com/clap-rs/clap
synced 2024-09-21 06:41:54 +00:00
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
This commit is contained in:
parent
c83a559df1
commit
f7a8877978
1 changed files with 7 additions and 0 deletions
|
@ -597,6 +597,13 @@ macro_rules! app_from_crate {
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! clap_app {
|
macro_rules! clap_app {
|
||||||
(@app ($builder:expr)) => { $builder };
|
(@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)*) => {
|
(@app ($builder:expr) (@arg $name:ident: $($tail:tt)*) $($tt:tt)*) => {
|
||||||
clap_app!{ @app
|
clap_app!{ @app
|
||||||
($builder.arg(
|
($builder.arg(
|
||||||
|
|
Loading…
Reference in a new issue