pub struct SubcommandSet<Ctx> { /* private fields */ }Implementations§
Source§impl<Ctx> SubcommandSet<Ctx>where
Ctx: 'static,
impl<Ctx> SubcommandSet<Ctx>where
Ctx: 'static,
Sourcepub fn toggle<F>(
self,
name: &'static str,
help: &'static str,
handler: F,
) -> SubcommandSet<Ctx>
pub fn toggle<F>( self, name: &'static str, help: &'static str, handler: F, ) -> SubcommandSet<Ctx>
Parses on|off|true|false|1|0; a bare invocation passes None.
Sourcepub fn choice<F>(
self,
name: &'static str,
help: &'static str,
choices: &[&'static str],
handler: F,
) -> SubcommandSet<Ctx>
pub fn choice<F>( self, name: &'static str, help: &'static str, choices: &[&'static str], handler: F, ) -> SubcommandSet<Ctx>
The handler receives the raw value string, unvalidated against choices.
Sourcepub fn custom<F>(
self,
name: &'static str,
help: &'static str,
arg_choices: &[&[&'static str]],
value_choices: &[(&'static str, &[&'static str])],
handler: F,
) -> SubcommandSet<Ctx>
pub fn custom<F>( self, name: &'static str, help: &'static str, arg_choices: &[&[&'static str]], value_choices: &[(&'static str, &[&'static str])], handler: F, ) -> SubcommandSet<Ctx>
arg_choices[i] completes the i-th arg after the subcommand name.
Sourcepub fn with_long_help(self, long: &'static str) -> SubcommandSet<Ctx>
pub fn with_long_help(self, long: &'static str) -> SubcommandSet<Ctx>
The subcommand table is appended either way.
Trait Implementations§
Source§impl<Ctx> Command<Ctx> for SubcommandSet<Ctx>where
Ctx: 'static,
impl<Ctx> Command<Ctx> for SubcommandSet<Ctx>where
Ctx: 'static,
fn name(&self) -> &str
fn help(&self) -> &str
fn arg_choices(&self, arg_index: usize) -> &[&'static str]
Source§fn arg_choices_ctx<'a>(
&'a self,
arg_index: usize,
prior: &[&str],
) -> &'a [&'static str]
fn arg_choices_ctx<'a>( &'a self, arg_index: usize, prior: &[&str], ) -> &'a [&'static str]
prior is the arg tokens before the cursor.fn arg_value_choices_ctx<'a>( &'a self, _arg_index: usize, key: &str, prior: &[&str], ) -> &'a [&'static str]
Auto Trait Implementations§
impl<Ctx> !Freeze for SubcommandSet<Ctx>
impl<Ctx> !RefUnwindSafe for SubcommandSet<Ctx>
impl<Ctx> !Send for SubcommandSet<Ctx>
impl<Ctx> !Sync for SubcommandSet<Ctx>
impl<Ctx> Unpin for SubcommandSet<Ctx>
impl<Ctx> UnsafeUnpin for SubcommandSet<Ctx>
impl<Ctx> !UnwindSafe for SubcommandSet<Ctx>
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