mirror of
https://github.com/clap-rs/clap
synced 2025-03-05 07:47:40 +00:00
move assert
This commit is contained in:
parent
443cc3e145
commit
a7224b5255
1 changed files with 3 additions and 2 deletions
|
@ -359,6 +359,9 @@ fn gen_augmentation(fields: &[Field], app_var: &Ident) -> quote::Tokens {
|
|||
quote!( let #app_var = #subcmd_type ::augment_clap( #app_var ); )
|
||||
})
|
||||
.collect();
|
||||
|
||||
assert!(subcmds.len() <= 1, "cannot have more than one nested subcommand");
|
||||
|
||||
let args = fields.iter()
|
||||
.filter(|&field| !is_subcommand(field))
|
||||
.map(|field| {
|
||||
|
@ -391,8 +394,6 @@ fn gen_augmentation(fields: &[Field], app_var: &Ident) -> quote::Tokens {
|
|||
quote!( .arg(_structopt::clap::Arg::with_name(stringify!(#name)) #modifier #(#from_attr)*) )
|
||||
});
|
||||
|
||||
assert!(subcmds.len() <= 1, "cannot have more than one nested subcommand");
|
||||
|
||||
quote! {{
|
||||
use std::error::Error;
|
||||
let #app_var = #app_var #( #args )* ;
|
||||
|
|
Loading…
Add table
Reference in a new issue