[−][src]Struct xcli::Command
Command structure, which describes a command and its action.
Implementations
impl<'a> Command<'a>
[src]
pub fn new<S: Into<String>>(n: S) -> Self
[src]
Create a command
pub fn get_name(&self) -> &str
[src]
Get the name of this command
pub fn action(self, action: fn(_: &App<'_>, _: &[&str]) -> XcliResult) -> Self
[src]
Set a CmdAction to this command
pub fn about<S: Into<&'a str>>(self, about: S) -> Self
[src]
Set a description to this command
pub fn usage<S: Into<&'a str>>(self, about: S) -> Self
[src]
Set the usage to this command
pub fn get_subcommands(&self) -> &[Command<'a>]
[src]
Get all subcommands of this command
pub fn subcommand(self, subcmd: Command<'a>) -> Self
[src]
Add a subcommand to this command
pub fn subcommands<I>(self, subcmds: I) -> Self where
I: IntoIterator<Item = Command<'a>>,
[src]
I: IntoIterator<Item = Command<'a>>,
Add more than one subcommand to this command, the given subcmds implements IntoIterator
pub fn show_command_usage(&self)
[src]
show usage message for command.
pub fn show_command_help(&self)
[src]
show help message for command.
pub fn show_subcommand_help(&self)
[src]
show help message for command and its subs
pub fn locate_subcommand(&self, args: &[&str]) -> Option<&Command<'_>>
[src]
locate the sub command by the args given
pub fn run_sub(&self, app: &App<'_>, args: &[&str]) -> XcliResult
[src]
run sub commands
show error message when action not found but with extra args
show help messages when action not found for the sub command
execute sub command when action found
pub fn for_each<F>(&self, path: &str, f: &mut F) where
F: FnMut(&Self, &str),
[src]
F: FnMut(&Self, &str),
Trait Implementations
Auto Trait Implementations
impl<'a> RefUnwindSafe for Command<'a>
[src]
impl<'a> Send for Command<'a>
[src]
impl<'a> Sync for Command<'a>
[src]
impl<'a> Unpin for Command<'a>
[src]
impl<'a> UnwindSafe for Command<'a>
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,