mirror of
https://github.com/Drop-OSS/interactive-clap.git
synced 2026-07-19 20:03:34 -04:00
refactor: Updated examples:struct_with_flatten (#19)
This commit is contained in:
@@ -25,6 +25,4 @@ shell-words = "1.0.0"
|
||||
clap = { version = "4.0.18", features = ["derive"] }
|
||||
|
||||
inquire = "0.6"
|
||||
atty = "0.2.14"
|
||||
colored = "2.0"
|
||||
color-eyre = "0.6"
|
||||
|
||||
@@ -231,16 +231,7 @@ impl FromStr for ColorPreference {
|
||||
}
|
||||
|
||||
fn default_mode() -> ColorPreference {
|
||||
match env::var("NO_COLOR") {
|
||||
Ok(v) if v != "0" => ColorPreference::Never,
|
||||
_ => {
|
||||
if atty::is(atty::Stream::Stderr) {
|
||||
ColorPreference::Always
|
||||
} else {
|
||||
ColorPreference::Never
|
||||
}
|
||||
}
|
||||
}
|
||||
ColorPreference::Never
|
||||
}
|
||||
|
||||
impl ColorPreference {
|
||||
@@ -251,16 +242,6 @@ impl ColorPreference {
|
||||
ColorPreference::Never => "never",
|
||||
}
|
||||
}
|
||||
|
||||
pub fn apply(&self) {
|
||||
match self {
|
||||
ColorPreference::Auto => {
|
||||
default_mode().apply();
|
||||
}
|
||||
ColorPreference::Always => colored::control::set_override(true),
|
||||
ColorPreference::Never => colored::control::set_override(false),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn main() -> color_eyre::Result<()> {
|
||||
|
||||
Reference in New Issue
Block a user