Skip to main content

CommandRunner

Trait CommandRunner 

Source
pub trait CommandRunner {
    // Required method
    fn run(
        &self,
        cmd: &Command,
        input: Option<&PipeValue>,
    ) -> Result<CommandOutput, ExecutionError>;
}
Expand description

Port: dispatches a single slash command and returns its output.

Implement this trait to define what each command actually does. The orchestration engine (Executor) handles &&/||/|/|& semantics, optional-pipe context accumulation, and redirection; this trait handles only individual command dispatch.

§Contract

  • cmd.name is the normalized, lowercase command name.
  • input is the pipe value arriving from the left, if any.
  • Returning Ok with success: false is a soft failure — the executor uses it for &&/|| branching but does not propagate it as an error.
  • Returning Err is a hard failure that aborts execution immediately.

Required Methods§

Implementors§