Trait brush_core::builtins::Command

source ·
pub trait Command: Parser {
    // Required method
    fn execute<'life0, 'life1, 'async_trait>(
        &'life0 self,
        context: ExecutionContext<'life1>,
    ) -> Pin<Box<dyn Future<Output = Result<ExitCode, Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided methods
    fn new<I>(args: I) -> Result<Self, Error>
       where I: IntoIterator<Item = String> { ... }
    fn takes_plus_options() -> bool { ... }
    fn get_content(
        name: &str,
        content_type: ContentType,
    ) -> Result<String, Error> { ... }
}
Expand description

Trait implemented by built-in shell commands.

Required Methods§

source

fn execute<'life0, 'life1, 'async_trait>( &'life0 self, context: ExecutionContext<'life1>, ) -> Pin<Box<dyn Future<Output = Result<ExitCode, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Executes the built-in command in the provided context.

§Arguments
  • context - The context in which the command is being executed.

Provided Methods§

source

fn new<I>(args: I) -> Result<Self, Error>
where I: IntoIterator<Item = String>,

Instantiates the built-in command with the given arguments.

§Arguments
  • args - The arguments to the command.
source

fn takes_plus_options() -> bool

Returns whether or not the command takes options with a leading ‘+’ or ‘-’ character.

source

fn get_content(name: &str, content_type: ContentType) -> Result<String, Error>

Returns the textual help content associated with the command.

§Arguments
  • name - The name of the command.
  • content_type - The type of content to retrieve.

Object Safety§

This trait is not object safe.

Implementors§