pub struct CommandRunner { /* private fields */ }Expand description
Command runner for executing commands with lifecycle management.
Implementations§
Source§impl CommandRunner
impl CommandRunner
Sourcepub fn new(ctx: CliContext) -> Self
pub fn new(ctx: CliContext) -> Self
Create a new command runner.
Sourcepub fn add_hook(&mut self, hook: impl CommandHook + 'static)
pub fn add_hook(&mut self, hook: impl CommandHook + 'static)
Add a command hook.
Sourcepub async fn run(&self, cmd: &dyn Command) -> CliResult<CommandOutput>
pub async fn run(&self, cmd: &dyn Command) -> CliResult<CommandOutput>
Run a command.
Sourcepub async fn run_with_shutdown<C: Command>(
&self,
cmd: &C,
) -> CliResult<CommandOutput>
pub async fn run_with_shutdown<C: Command>( &self, cmd: &C, ) -> CliResult<CommandOutput>
Run a command with graceful shutdown support.
Sourcepub fn context(&self) -> Arc<RwLock<CliContext>>
pub fn context(&self) -> Arc<RwLock<CliContext>>
Get the context.
Auto Trait Implementations§
impl Freeze for CommandRunner
impl !RefUnwindSafe for CommandRunner
impl Send for CommandRunner
impl Sync for CommandRunner
impl Unpin for CommandRunner
impl !UnwindSafe for CommandRunner
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more