pub struct GroupSpec {
pub name: String,
pub short: String,
pub long: Option<String>,
pub aliases: Vec<String>,
pub hidden: bool,
pub commands: Vec<CommandSpec>,
pub groups: Vec<GroupSpec>,
}Expand description
Declarative command group metadata.
Groups are noun-based containers. They do not run business logic directly; when invoked bare, the CLI renders group help.
Fields§
§name: StringGroup command name.
short: StringOne-line group description.
long: Option<String>Optional long help text.
aliases: Vec<String>Alternate group names accepted by the parser.
Whether the group runs but is hidden from discovery output.
commands: Vec<CommandSpec>Declarative child commands used for static tree construction.
groups: Vec<GroupSpec>Declarative nested groups used for static tree construction.
Implementations§
Source§impl GroupSpec
impl GroupSpec
Sourcepub fn new(name: impl Into<String>, short: impl Into<String>) -> Self
pub fn new(name: impl Into<String>, short: impl Into<String>) -> Self
Creates a command group with the required name and one-line help.
Sourcepub fn with_alias(self, alias: impl Into<String>) -> Self
pub fn with_alias(self, alias: impl Into<String>) -> Self
Adds one group alias.
Hides or shows this group in discovery output.
Sourcepub fn with_command(self, command: CommandSpec) -> Self
pub fn with_command(self, command: CommandSpec) -> Self
Adds one declarative child command.
Sourcepub fn with_group(self, group: GroupSpec) -> Self
pub fn with_group(self, group: GroupSpec) -> Self
Adds one declarative nested group.
Sourcepub fn clap_command(&self) -> Command
pub fn clap_command(&self) -> Command
Builds the clap command for parser registration.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for GroupSpec
impl !UnwindSafe for GroupSpec
impl Freeze for GroupSpec
impl Send for GroupSpec
impl Sync for GroupSpec
impl Unpin for GroupSpec
impl UnsafeUnpin for GroupSpec
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more