Skip to main content

parse_args

Function parse_args 

Source
pub fn parse_args(meta: &AdapterMeta) -> Cli
Expand description

Parse process args into Cli, splicing the adapter’s runtime metadata into clap’s help / --version output.

Split out from run purely to keep the parse step monomorphic and off the binary’s hot path on --help / --version (clap intercepts those before parse_args returns). The adapter binary supplies its coverage adapter to run as a factory closure that’s invoked once after CLI/config-file merging resolves the effective source root — pre-construction lets the coverage parser strip the wrong prefix from per-file records when cli.input.src is None because src came from the adapter’s config TOML rather than the CLI.

AdapterMeta::{tool_version, long_version, about, long_about, after_help} flow into clap’s help / --version output at runtime so the binary’s build-script metadata reaches the help text — the derive macro’s version reads CARGO_PKG_VERSION at lib-crate compile time (crap-core’s 0.1.0); the adapter binary’s own CARGO_PKG_VERSION and <ADAPTER>_LONG_VERSION only resolve in the binary’s compile and reach us by parameter.