Trait shi::command::BaseCommand [−][src]
BaseCommand is the lower-level command trait. It covers many of the behaviors one would expect
from a shell command, e.g., a name (name()
) or execution (execute()
).
It is generic over a State
, S
, expected to be bound to its containing Shell
.
As it may aid in understanding: builtins are in fact BaseCommand
’s, where State = Shell<T>
.
Associated Types
Loading content...Required methods
fn name(&self) -> &str
[src]
Returns the name of the command. This is equivalent to how the command would be invoked.
fn validate_args(&self, args: &[String]) -> Result<()>
[src]
Validates the given arguments, returning a Result<()>
indicating the result of
validation.
Arguments
args
- The arguments to validate.
fn execute(&self, state: &mut Self::State, args: &[String]) -> Result<String>
[src]
Provided methods
fn autocomplete(&self, _args: Vec<&str>, _trailing_space: bool) -> Completion
[src]
Autocompletes a command, given arguments.
The default implementation provides no autocompletion.
Arguments
args
- The arguments to autocomplete.
trailing_space
- A boolean to indicate if there is a trailing space at the end of the
line where a user has asked for completion.
Returns
Completion
- The completion result.
fn help(&self) -> String
[src]
Returns a String representing the help text of this command. By default, returns nothing.
Expected to be relatively brief.