Command

Trait Command 

Source
pub trait Command {
    // Required methods
    fn execute<'life0, 'life1, 'async_trait>(
        &'life0 self,
        bot: &'life1 Bot,
    ) -> Pin<Box<dyn Future<Output = CliResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn name(&self) -> &'static str;

    // Provided methods
    fn execute_with_output<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        bot: &'life1 Bot,
        _output_format: &'life2 OutputFormat,
    ) -> Pin<Box<dyn Future<Output = CliResult<()>> + Send + 'async_trait>>
       where Self: Sync + 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
    fn validate(&self) -> CliResult<()> { ... }
}
Expand description

Trait that all CLI commands must implement

Required Methods§

Source

fn execute<'life0, 'life1, 'async_trait>( &'life0 self, bot: &'life1 Bot, ) -> Pin<Box<dyn Future<Output = CliResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Execute the command

Source

fn name(&self) -> &'static str

Get command name for logging

Provided Methods§

Source

fn execute_with_output<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, bot: &'life1 Bot, _output_format: &'life2 OutputFormat, ) -> Pin<Box<dyn Future<Output = CliResult<()>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Execute the command with structured output support (optional implementation)

Source

fn validate(&self) -> CliResult<()>

Validate command arguments before execution

Implementors§