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

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

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.