Skip to main content

pre_parse_flag_present

Function pre_parse_flag_present 

Source
pub(crate) fn pre_parse_flag_present(flag: &str) -> bool
Expand description

Returns whether flag is present among the binary’s leading top-level options.

The scan ends at the first -- separator, the first subcommand or positional token, or the first non-UTF-8 token (none of which can match the ASCII flags this helper supports). Values of known value-taking global options are skipped, so e.g. forge --color always --introspect and forge -j 4 --introspect still match.

Use for non-clap-global pre-parse flags (--introspect, --markdown-help). For clap-globals like --machine, use pre_parse_global_flag_present.