refactor: Updated examples:struct_with_flatten (#19)

This commit is contained in:
FroVolod
2024-04-23 11:14:46 +03:00
committed by GitHub
parent bd650fe49e
commit fc8af6e010
2 changed files with 1 additions and 22 deletions
-2
View File
@@ -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"
+1 -20
View File
@@ -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<()> {