Skip to content

Commit b5d7366

Browse files
committed
feat: allow COLOR_OVERRIDE env to force colored output rendering
1 parent 2fb0af1 commit b5d7366

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

crates/but/src/main.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,14 @@ mod status;
2525

2626
#[tokio::main]
2727
async fn main() -> Result<()> {
28+
if let Ok(color_override) = std::env::var("COLOR_OVERRIDE") {
29+
match color_override.to_lowercase().as_str() {
30+
"true" | "1" | "on" | "yes" => colored::control::set_override(true),
31+
"false" | "0" | "off" | "no" => colored::control::set_override(false),
32+
_ => {}
33+
}
34+
}
35+
2836
// Check if help is requested with no subcommand
2937
if std::env::args().len() == 1
3038
|| std::env::args().any(|arg| arg == "--help" || arg == "-h") && std::env::args().len() == 2

0 commit comments

Comments
 (0)