Skip to main content

cli_handle_help_or_continue

Function cli_handle_help_or_continue 

Source
pub fn cli_handle_help_or_continue(
    raw_args: &[String],
    cmd: &Command,
    config: &HelpConfig,
) -> Result<Option<String>, Value>
Expand description

Render help from raw argv if a help flag is present; otherwise return None.

raw_args should be the full argv vector, including argv[0], as produced by std::env::args(). The helper intentionally runs before clap parsing so --help --recursive and --help --output markdown can select scope and format instead of being consumed by clap’s built-in help handling. Scope (--recursive) and format (--output) are orthogonal.

A bare --recursive without --help is treated as a non-help request (Ok(None)), leaving the flag for the application’s own parser.

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

Requires the cli-help feature.