Skip to main content

PreRunHook

Type Alias PreRunHook 

Source
pub type PreRunHook = fn(App) -> PreRunFuture;
Expand description

A pre-run hook, invoked with the App before command dispatch.

Runs after CLI parsing and before the matched command. Leaf crates register cross-cutting pre-dispatch logic here (e.g. the self-update policy check) via distributed_slice, keeping rtb-cli decoupled from them — exactly like BUILTIN_COMMANDS.

Contract: a hook must be fast and order-independent — link-time registration order across crates is not deterministic. A hook returning Err aborts the run before the command executes, so advisory hooks that must not block the command should swallow their own errors.