Skip to content

Commit 2ea9455

Browse files
authored
Merge pull request #4310 from epage/skip
fix(derive): Support 'group' attribute with Parser
2 parents 106d8f5 + 5f145a2 commit 2ea9455

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

clap_derive/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ pub fn value_enum(input: TokenStream) -> TokenStream {
4242
/// receiving an instance of `clap::ArgMatches` from conducting parsing, and then
4343
/// implementing a conversion code to instantiate an instance of the user
4444
/// context struct.
45-
#[proc_macro_derive(Parser, attributes(clap, structopt, command, arg))]
45+
#[proc_macro_derive(Parser, attributes(clap, structopt, command, arg, group))]
4646
#[proc_macro_error]
4747
pub fn parser(input: TokenStream) -> TokenStream {
4848
let input: DeriveInput = parse_macro_input!(input);

tests/derive/groups.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ For more information try '--help'
6262
#[test]
6363
fn skip_group_avoids_duplicate_ids() {
6464
#[derive(Parser, Debug)]
65+
#[group(skip)]
6566
struct Opt {
6667
#[command(flatten)]
6768
first: Compose<Empty, Empty>,
@@ -88,7 +89,7 @@ fn skip_group_avoids_duplicate_ids() {
8889
use clap::Args;
8990
assert_eq!(Empty::group_id(), None);
9091
assert_eq!(Compose::<Empty, Empty>::group_id(), None);
91-
assert_eq!(Opt::group_id(), Some(clap::Id::from("Opt")));
92+
assert_eq!(Opt::group_id(), None);
9293
}
9394

9495
#[test]

0 commit comments

Comments
 (0)