pub struct CommandDesc(/* private fields */);Expand description
Introspectable command description.
Implementations§
Source§impl CommandDesc
impl CommandDesc
Sourcepub fn canonical_name(&self) -> &str
pub fn canonical_name(&self) -> &str
Returns the canonical name of the command.
This is derived from the name of the crate that defines the command.
The invoked name of a command is argv[0], which is typically the name of the executable,
and may differ from the canonical name.
pub fn description(&self) -> Option<&str>
Sourcepub fn version(&self) -> Option<&str>
pub fn version(&self) -> Option<&str>
Returns the version string of the command.
This defaults to the Cargo package version (via CARGO_PKG_VERSION), but can be customized
via #[larpa(version = "custom-version")].
Returns None when no version was specified manually and CARGO_PKG_VERSION was not set
(likely because the package wasn’t built by Cargo).
Sourcepub fn license(&self) -> Option<&str>
pub fn license(&self) -> Option<&str>
Returns the program license identifier.
By default, this is taken from the package’s Cargo.toml, but it can be overridden with
#[larpa(license)].
pub fn homepage(&self) -> Option<&str>
pub fn repository(&self) -> Option<&str>
pub fn args(&self) -> &[ArgumentDesc]
pub fn is_subcommand_optional(&self) -> bool
Sourcepub fn has_subcommand_fallback(&self) -> bool
pub fn has_subcommand_fallback(&self) -> bool
Returns true if there may be invokable subcommands beyond the ones in
CommandDesc::subcommands.
This is true when the command is an enum with a variant annotated with
#[larpa(fallback)].
Sourcepub fn discover_subcommands(&self) -> Vec<DiscoveredSubcommand>
pub fn discover_subcommands(&self) -> Vec<DiscoveredSubcommand>
Invokes the dynamic subcommand discovery function.
For enums with a #[larpa(fallback)] variant, a dynamic subcommand discovery
function may be provided by the user that finds additional applicable subcommands at
runtime.
If #[larpa(discover)] was not used, this will return an empty Vec.
Sourcepub fn subcommands(&self) -> &[SubcommandDesc]
pub fn subcommands(&self) -> &[SubcommandDesc]
Returns the list of built-in subcommands, if this command has any.
Trait Implementations§
Source§impl Clone for CommandDesc
impl Clone for CommandDesc
Source§fn clone(&self) -> CommandDesc
fn clone(&self) -> CommandDesc
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more