Skip to content

Commit

Permalink
fix(derive): Pipe group attribute through
Browse files Browse the repository at this point in the history
Still doesn't support any attributes within it yet.
  • Loading branch information
epage committed Sep 30, 2022
1 parent 2912a64 commit 6ca0569
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
7 changes: 3 additions & 4 deletions clap_derive/src/attr.rs
Expand Up @@ -35,10 +35,7 @@ impl ClapAttr {
} 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"
)
Some(Sp::new(AttrKind::Group, attr.path.span()))
} else if attr.path.is_ident("arg") {
Some(Sp::new(AttrKind::Arg, attr.path.span()))
} else if attr.path.is_ident("value") {
Expand Down Expand Up @@ -202,6 +199,7 @@ pub enum AttrKind {
Clap,
StructOpt,
Command,
Group,
Arg,
Value,
}
Expand All @@ -212,6 +210,7 @@ impl AttrKind {
Self::Clap => "clap",
Self::StructOpt => "structopt",
Self::Command => "command",
Self::Group => "group",
Self::Arg => "arg",
Self::Value => "value",
}
Expand Down
8 changes: 6 additions & 2 deletions clap_derive/src/item.rs
Expand Up @@ -291,7 +291,7 @@ impl Item {
),
});
}
AttrKind::Arg | AttrKind::Clap | AttrKind::StructOpt => {}
AttrKind::Group | AttrKind::Arg | AttrKind::Clap | AttrKind::StructOpt => {}
}
self.name = Name::Assigned(quote!(#arg));
} else if name == "name" {
Expand All @@ -309,7 +309,11 @@ impl Item {
),
});
}
AttrKind::Command | AttrKind::Value | AttrKind::Clap | AttrKind::StructOpt => {}
AttrKind::Group
| AttrKind::Command
| AttrKind::Value
| AttrKind::Clap
| AttrKind::StructOpt => {}
}
self.name = Name::Assigned(quote!(#arg));
} else if name == "value_parser" {
Expand Down

0 comments on commit 6ca0569

Please sign in to comment.