Skip to main content

switch

Function switch 

Source
pub fn switch(on: bool) -> bool
Available on crate feature cli only.
Expand description

The value of a --x/--no-x pair declared with Clap’s overrides_with both ways: on, the --x flag, returned unchanged.

Clap clears the flag that came first, so on already holds the answer. The call names that rule at the call site, so a reader does not look for a missing check of --no-x.