pub trait Command: Send + Sync {
// Required methods
fn name(&self) -> &str;
fn description(&self) -> &str;
fn execute<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 mut CliContext,
) -> Pin<Box<dyn Future<Output = CliResult<CommandOutput>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
// Provided methods
fn validate(&self) -> CliResult<()> { ... }
fn requires_engine(&self) -> bool { ... }
fn supports_shutdown(&self) -> bool { ... }
}Expand description
Trait for executable commands.
All CLI commands implement this trait for consistent execution.
Required Methods§
Sourcefn description(&self) -> &str
fn description(&self) -> &str
Get the command description.
Sourcefn execute<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 mut CliContext,
) -> Pin<Box<dyn Future<Output = CliResult<CommandOutput>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn execute<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 mut CliContext,
) -> Pin<Box<dyn Future<Output = CliResult<CommandOutput>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Execute the command.
Provided Methods§
Sourcefn requires_engine(&self) -> bool
fn requires_engine(&self) -> bool
Check if this command requires an engine instance.
Sourcefn supports_shutdown(&self) -> bool
fn supports_shutdown(&self) -> bool
Check if this command supports graceful shutdown.