pub struct CommandSchema {
pub name: String,
pub description: String,
pub options: Vec<CLOption>,
pub arguments: Vec<CLArgument>,
pub subcommands: Vec<CommandSchema>,
}Expand description
Schema for a command (root or subcommand). Build with the fluent API or construct the struct literally for tests.
Fields§
§name: String§description: String§options: Vec<CLOption>§arguments: Vec<CLArgument>§subcommands: Vec<CommandSchema>Implementations§
Source§impl CommandSchema
impl CommandSchema
pub fn new(name: impl Into<String>, description: impl Into<String>) -> Self
Sourcepub fn option_named(
self,
prefix: &str,
value_name: &str,
description: &str,
) -> Self
pub fn option_named( self, prefix: &str, value_name: &str, description: &str, ) -> Self
Add a value-consuming option with a custom placeholder shown in help.
Sourcepub fn argument(self, name: &str, description: &str) -> Self
pub fn argument(self, name: &str, description: &str) -> Self
Add a required positional argument.
Sourcepub fn optional_argument(self, name: &str, description: &str) -> Self
pub fn optional_argument(self, name: &str, description: &str) -> Self
Add an optional positional argument.
Sourcepub fn subcommand(self, schema: CommandSchema) -> Self
pub fn subcommand(self, schema: CommandSchema) -> Self
Register a subcommand schema.
Trait Implementations§
Source§impl Clone for CommandSchema
impl Clone for CommandSchema
Source§fn clone(&self) -> CommandSchema
fn clone(&self) -> CommandSchema
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for CommandSchema
impl RefUnwindSafe for CommandSchema
impl Send for CommandSchema
impl Sync for CommandSchema
impl Unpin for CommandSchema
impl UnsafeUnpin for CommandSchema
impl UnwindSafe for CommandSchema
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