diff --git a/Cargo.lock b/Cargo.lock index 2b0446d..f077741 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -261,6 +261,12 @@ version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" +[[package]] +name = "hermit-abi" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f154ce46856750ed433c8649605bf7ed2de3bc35fd9d2a9f30cddd873c80cb08" + [[package]] name = "indexmap" version = "2.9.0" @@ -271,6 +277,17 @@ dependencies = [ "hashbrown", ] +[[package]] +name = "is-terminal" +version = "0.4.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e04d7f318608d35d4b61ddd75cbdaee86b023ebe2bd5a66ee0915f0bf93095a9" +dependencies = [ + "hermit-abi 0.5.1", + "libc", + "windows-sys", +] + [[package]] name = "is_terminal_polyfill" version = "1.70.1" @@ -364,7 +381,7 @@ version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" dependencies = [ - "hermit-abi", + "hermit-abi 0.3.9", "libc", ] @@ -697,3 +714,6 @@ name = "yansi" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cfe53a6657fd280eaa890a3bc59152892ffa3e30101319d168b781ed6529b049" +dependencies = [ + "is-terminal", +] diff --git a/Cargo.toml b/Cargo.toml index 287929e..aeecd4b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,5 +19,5 @@ thiserror = "2.0" anyhow = "1.0" jiff = "0.2.13" clap-verbosity-flag = "3.0.2" -yansi = "1.0.1" +yansi = { version = "1.0.1", features = ["detect-env", "detect-tty"] } derive_more = { version = "2.0.1", features = ["full"] } diff --git a/src/main.rs b/src/main.rs index cd6258f..e435cee 100644 --- a/src/main.rs +++ b/src/main.rs @@ -50,6 +50,8 @@ enum Command { fn real_main() -> anyhow::Result<()> { let cli = Cli::parse(); + yansi::whenever(yansi::Condition::TTY_AND_COLOR); + env_logger::Builder::new() .filter_level(cli.verbosity.log_level_filter()) .format_timestamp(None)