Enum shi::command::Command [−][src]
pub enum Command<'a, S> {
Leaf(Box<dyn BaseCommand<State = S> + 'a>),
Parent(ParentCommand<'a, S>),
}
Expand description
Command represents all and any command that should exist in shi. It represents a clear
bifurcation: a command is either a Leaf
or a Parent
command.
This refers to tree terminology; a command either has no children (subcommands) or it does.
Thus, it is either a Leaf command or a Parent
command, respectively.
Variants
Leaf(Box<dyn BaseCommand<State = S> + 'a>)
A command that has no sub commands. Conforms to BaseCommand
. Executes, unlike Parent
.
Tuple Fields of Leaf
0: Box<dyn BaseCommand<State = S> + 'a>
Parent(ParentCommand<'a, S>)
A command that has sub commands. A ParentCommand
does not execute.
Tuple Fields of Parent
0: ParentCommand<'a, S>
Implementations
Creates a new Leaf
Command
from the given command.
Creates a new Parent
Command
from the given vector of sub commands.
Trait Implementations
type State = S
type State = S
The State of the command. Expected to be bound to a containing Shell
.
Returns the name of the command. This is equivalent to how the command would be invoked.
Validates the given arguments, returning a Result<()>
indicating the result of
validation. Read more
Executes the command. Read more
Returns a String representing the help text of this command. By default, returns nothing. Read more
Autocompletes a command, given arguments. Read more