Struct clap::SubCommand
source · pub struct SubCommand<'n, 'a> { /* private fields */ }Expand description
The abstract representation of a command line subcommand used by the consumer of the library.
This struct is used by the library consumer and describes all the valid options of the subcommand for their program. SubCommands are treated like “sub apps” and contain all the same possibilities (such as their own arguments and subcommands).
§Example
SubCommand::new("conifg")
.about("Used for configuration")
.arg(Arg::new("config_file")
.help("The configuration file to use")
.index(1))Implementations§
source§impl<'n, 'a> SubCommand<'n, 'a>
impl<'n, 'a> SubCommand<'n, 'a>
sourcepub fn with_name<'au, 'v, 'ab, 'u, 'h, 'ar>(
name: &'ar str,
) -> App<'au, 'v, 'ab, 'u, 'h, 'ar>
pub fn with_name<'au, 'v, 'ab, 'u, 'h, 'ar>( name: &'ar str, ) -> App<'au, 'v, 'ab, 'u, 'h, 'ar>
Creates a new instance of a subcommand requiring a name. Will be displayed to the user when they print version or help and usage information.
§Example
SubCommand::new("config")sourcepub fn new<'au, 'v, 'ab, 'u, 'h, 'ar>(
name: &'ar str,
) -> App<'au, 'v, 'ab, 'u, 'h, 'ar>
pub fn new<'au, 'v, 'ab, 'u, 'h, 'ar>( name: &'ar str, ) -> App<'au, 'v, 'ab, 'u, 'h, 'ar>
WARNING: This function is deprecated. Use SubCommand::with_name() instead.
Creates a new instance of a subcommand requiring a name. Will be displayed to the user when they print version or help and usage information.
§Example
SubCommand::new("config")Auto Trait Implementations§
impl<'n, 'a> Freeze for SubCommand<'n, 'a>
impl<'n, 'a> RefUnwindSafe for SubCommand<'n, 'a>
impl<'n, 'a> Send for SubCommand<'n, 'a>
impl<'n, 'a> Sync for SubCommand<'n, 'a>
impl<'n, 'a> Unpin for SubCommand<'n, 'a>
impl<'n, 'a> UnwindSafe for SubCommand<'n, 'a>
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