feat(derive): Reserve 'group' attribute

This commit is contained in:
Ed Page 2022-09-13 07:02:10 -05:00
parent 79321f25e4
commit 3bfa9d5ff0
2 changed files with 7 additions and 2 deletions

View file

@ -34,6 +34,11 @@ impl ClapAttr {
Some(Sp::new(AttrKind::StructOpt, attr.path.span()))
} else if attr.path.is_ident("command") {
Some(Sp::new(AttrKind::Command, attr.path.span()))
} else if attr.path.is_ident("group") {
abort!(
attr.path.span(),
"`#[group()]` attributes are not supported yet"
)
} else if attr.path.is_ident("arg") {
Some(Sp::new(AttrKind::Arg, attr.path.span()))
} else if attr.path.is_ident("value") {

View file

@ -50,7 +50,7 @@ pub fn parser(input: TokenStream) -> TokenStream {
}
/// Generates the `Subcommand` impl.
#[proc_macro_derive(Subcommand, attributes(clap, command, arg))]
#[proc_macro_derive(Subcommand, attributes(clap, command, arg, group))]
#[proc_macro_error]
pub fn subcommand(input: TokenStream) -> TokenStream {
let input: DeriveInput = parse_macro_input!(input);
@ -58,7 +58,7 @@ pub fn subcommand(input: TokenStream) -> TokenStream {
}
/// Generates the `Args` impl.
#[proc_macro_derive(Args, attributes(clap, command, arg))]
#[proc_macro_derive(Args, attributes(clap, command, arg, group))]
#[proc_macro_error]
pub fn args(input: TokenStream) -> TokenStream {
let input: DeriveInput = parse_macro_input!(input);