Skip to main content

extract_region_flags

Function extract_region_flags 

Source
pub fn extract_region_flags(
    argv: Vec<String>,
) -> (Vec<String>, HashMap<String, String>)
Expand description

Pre-scan a full argv (program name first) for dynamic --<region> flags on the run subcommand, since region names are blueprint-defined and clap can’t declare them. Returns (argv_for_clap, region_flags): a --<name> (or --<name>=<value>) whose <name> is not a known run flag is pulled out (with its value) into the map; every other token passes through untouched.

A no-= region flag consumes the following token as its value. If argv has no run subcommand token, nothing is extracted (the returned argv equals the input). Pure - no environment or I/O - so it is unit-testable in isolation.