Skip to main content

cli_handle_version_or_continue

Function cli_handle_version_or_continue 

Source
pub fn cli_handle_version_or_continue(
    raw_args: &[String],
    name: &str,
    version: &str,
    config: &VersionConfig,
) -> Result<Option<String>, Value>
Expand description

Render version output from raw argv if --version or -V is present.

raw_args should be the full argv vector, including argv[0], as produced by std::env::args(). The helper intentionally runs before clap or another parser so explicit --output json|yaml|plain is honored instead of being bypassed by built-in version handling.

Returns a standard build_cli_error value when the version request is malformed, for example --version --output xml.