pub fn maybe_dispatch() -> Option<i32>Expand description
Runs the bundled-command fast path if the process was invoked for it.
If the process was invoked as brush <DISPATCH_FLAG> <NAME> [ARGS...]
(with <DISPATCH_FLAG> as the very first argument after argv[0]), runs
the registered function and returns its exit code as Some(code). The
caller is responsible for exiting the process with that code —
centralizing the exit call in the binary’s main() keeps destructors /
panic hooks / tracing guards in the loop.
Returns None when the process was not invoked as a bundled dispatch, so
normal shell startup can proceed.
The dispatch flag is only recognized in the leading position so that ordinary scripts and command lines containing the literal token elsewhere are not affected.