Skip to main content

ctl_core/flags/
mod.rs

1//! Shared clap flatten structs.
2
3mod color;
4mod dry_run;
5mod env;
6mod output;
7mod warn;
8
9pub use color::ColorLong;
10pub use dry_run::DryRunArgs;
11pub use env::{EnvPrefix, env_under_flags};
12pub use output::{FormatArgs, FormatLong, OutputArgs};
13pub use warn::{FlagWarning, WarningKind, chassis_warnings, emit_warnings, warn_opposites};
14
15use crate::color::ColorMode;
16
17/// `--no-color` wins over a `--color` value.
18#[must_use]
19pub fn resolve_color(color: ColorMode, no_color: bool) -> ColorMode {
20    if no_color { ColorMode::Never } else { color }
21}
22
23/// Last-wins boolean after clap `overrides_with`. `on` is the yes flag.
24#[must_use]
25pub fn switch(on: bool, _off: bool) -> bool {
26    on
27}