mirror of
https://github.com/clap-rs/clap
synced 2024-12-15 15:22:30 +00:00
move augment_clap
into inherent impl
This commit is contained in:
parent
f6bd33d5de
commit
443cc3e145
2 changed files with 5 additions and 5 deletions
|
@ -26,9 +26,6 @@ pub trait StructOpt {
|
||||||
/// Returns the corresponding `clap::App`.
|
/// Returns the corresponding `clap::App`.
|
||||||
fn clap<'a, 'b>() -> clap::App<'a, 'b>;
|
fn clap<'a, 'b>() -> clap::App<'a, 'b>;
|
||||||
|
|
||||||
/// Add this app's arguments/subcommands to another `clap::App`.
|
|
||||||
fn augment_clap<'a, 'b>(clap::App<'a, 'b>) -> clap::App<'a, 'b>;
|
|
||||||
|
|
||||||
/// Creates the struct from `clap::ArgMatches`.
|
/// Creates the struct from `clap::ArgMatches`.
|
||||||
fn from_clap(clap::ArgMatches) -> Self;
|
fn from_clap(clap::ArgMatches) -> Self;
|
||||||
|
|
||||||
|
|
|
@ -615,9 +615,12 @@ fn impl_structopt_for_struct(name: &Ident, fields: &[Field], attrs: &[Attribute]
|
||||||
quote! {
|
quote! {
|
||||||
impl _structopt::StructOpt for #name {
|
impl _structopt::StructOpt for #name {
|
||||||
#clap
|
#clap
|
||||||
#augment_clap
|
|
||||||
#from_clap
|
#from_clap
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl #name {
|
||||||
|
#augment_clap
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -637,11 +640,11 @@ fn impl_structopt_for_enum(name: &Ident, variants: &[Variant], attrs: &[Attribut
|
||||||
quote! {
|
quote! {
|
||||||
impl _structopt::StructOpt for #name {
|
impl _structopt::StructOpt for #name {
|
||||||
#clap
|
#clap
|
||||||
#augment_clap
|
|
||||||
#from_clap
|
#from_clap
|
||||||
}
|
}
|
||||||
|
|
||||||
impl #name {
|
impl #name {
|
||||||
|
#augment_clap
|
||||||
#from_subcommand
|
#from_subcommand
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue