Skip to main content

run_args

Function run_args 

Source
pub fn run_args<T>(args: &[T]) -> i32
where T: Into<OsString> + Clone,
Expand description

Parse args (argv WITHOUT the program name), boot the sinks, resolve the argv into a Command, run it and render the result. This is the ONE console composition root: the degenbot binary and the Python cli_main passthrough both land here, so their sequences cannot drift apart.

Returns the process exit code and never exits the process, so an embedded host can drive the console directly: clap owns --help/--version/usage errors (its own exit codes apply), a refused typed config is 2 (the same refusal exit the Python module init uses), and every command outcome maps through cli-core’s single CliError -> ExitCode site.

There is deliberately no host parameter here. The native and Python hosts are not abstracted behind a flag: their genuine difference lives upstream of this function — the Python #[pymodule] init has already installed the typed config and the driver’s log forwarder by the time this runs, while the native path gets both from sinks::boot() below — and boot’s first-wins installs keep that difference in place. A switch would hide the difference it cannot actually remove.