Skip to main content

dispatch_op

Function dispatch_op 

Source
pub fn dispatch_op(cmd: OpCommand) -> Result<(), OpError>
Expand description

Top-level dispatcher. The verb modules each load their own payload via --answers or --payload-json; this function only routes argv into the right library call.

Uses the built-in env-pack registry (five default local handlers). Phase D plug-ins that register additional handlers should call dispatch_op_with_registry instead, passing a registry populated with both built-ins and their plug-in handlers.

On success, the per-verb result is written to stdout as the documented {op, noun, result} envelope. On error, the documented {op, noun, error: {kind, message}} envelope is written to stderr and the same OpError is returned so callers can map it to a process exit code without re-rendering. Stdout and stderr never cross-contaminate.