pub struct SkillCliRequest { /* private fields */ }Expand description
A skill verb read out of its resolved invocation, ready to run later.
This is the pure half of a skill command: a program’s handler returns it (or carries it inside its own command type) before any output sink opens, and runs it afterwards with the emitter it was handed.
Implementations§
Source§impl SkillCliRequest
impl SkillCliRequest
Sourcepub fn from_invocation(invocation: &ResolvedInvocation) -> Result<Self, CliStop>
pub fn from_invocation(invocation: &ResolvedInvocation) -> Result<Self, CliStop>
Read a resolved skill verb registered by skill_cli_commands.
An invocation this module did not register is a defect in the program,
reported as cli_invocation_invalid (exit 1).
Sourcepub const fn action(&self) -> SkillAction
pub const fn action(&self) -> SkillAction
The action this request performs.
Sourcepub const fn options(&self) -> &SkillOptions
pub const fn options(&self) -> &SkillOptions
The options read from the command line.
Sourcepub fn execute(&self, spec: &SkillSpec<'_>) -> SkillCliOutcome
pub fn execute(&self, spec: &SkillSpec<'_>) -> SkillCliOutcome
Perform the action for spec without writing anything.
For a program with its own work to do once the skill files are in
place, before the command’s one terminal event is written. A program
with nothing to add calls SkillCliRequest::run.
Sourcepub fn run<W: Write>(
&self,
spec: &SkillSpec<'_>,
emitter: &mut CliEmitter<W>,
) -> u8
pub fn run<W: Write>( &self, spec: &SkillSpec<'_>, emitter: &mut CliEmitter<W>, ) -> u8
Perform the action for spec and emit its outcome: execute then
SkillCliOutcome::emit.