#[non_exhaustive]pub struct CommandInfo {
pub name: &'static str,
pub about: &'static str,
pub long_about: &'static str,
pub version: Option<&'static str>,
pub args: &'static [ArgInfo],
pub commands: &'static [CommandInfo],
pub subcommand_required: bool,
pub visible_aliases: &'static [&'static str],
pub aliases: &'static [&'static str],
pub hidden: bool,
}Expand description
The description of a command: its name, texts, arguments and subcommands.
Values are built with CommandInfo::new and the const builder methods, so that fields can
be added without breaking existing code.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.name: &'static strThe name of the command, as typed on the command line.
about: &'static strThe short description, from about or the first paragraph of the doc comment. Empty when
not set.
long_about: &'static strThe long description, from long_about or the full doc comment. Empty when not set.
version: Option<&'static str>The version set with #[command(version)].
args: &'static [ArgInfo]The arguments, flattened structs included, in field order, followed by the generated
--help and --version flags.
commands: &'static [CommandInfo]The subcommands, from a #[command(subcommand)] field, in variant order. Their
args do not repeat the global arguments of their parents.
subcommand_required: boolWhether one of the commands must be given.
visible_aliases: &'static [&'static str]The aliases of a subcommand listed in the help.
aliases: &'static [&'static str]The aliases of a subcommand hidden from the help.
Whether the subcommand is hidden from the help.
Implementations§
Source§impl CommandInfo
impl CommandInfo
Sourcepub const fn new(name: &'static str) -> Self
pub const fn new(name: &'static str) -> Self
A command named name, without description, version, arguments or subcommands.
Sourcepub const fn subcommand_required(self, required: bool) -> Self
pub const fn subcommand_required(self, required: bool) -> Self
Sets subcommand_required.
Sourcepub const fn visible_aliases(self, aliases: &'static [&'static str]) -> Self
pub const fn visible_aliases(self, aliases: &'static [&'static str]) -> Self
Sets visible_aliases.
Sets hidden.
Sourcepub const fn long_about(self, long_about: &'static str) -> Self
pub const fn long_about(self, long_about: &'static str) -> Self
Sets long_about.
Sourcepub const fn commands(self, commands: &'static [CommandInfo]) -> Self
pub const fn commands(self, commands: &'static [CommandInfo]) -> Self
Sets commands.