From af2f0ace2251f626a8c94329dc362d1f159b698b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Mon, 24 Oct 2022 17:34:37 +0200 Subject: [PATCH] Default to $TERM unset = colour on Win32 This otherwise respects all other configuration (NO_COLOR, TERM=dumb, &c.), but it's very common for the environment to be lacking TERM, which in that case usually means a pro-verbial TERM=cmd.exe, which is colourful Fixes: 049d1138c94b1654a80b3afc164bcc5c672560f5 ("Don't output colours by default if TERM=dumb or NO_COLOR=1") --- src/options.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/options.rs b/src/options.rs index 1ef3e01..67812cd 100644 --- a/src/options.rs +++ b/src/options.rs @@ -300,7 +300,7 @@ impl Options { OutputStyleOption::Basic } else if env::var_os("TERM") .map(|t| t == "unknown" || t == "dumb") - .unwrap_or(true) + .unwrap_or(!cfg!(target_os = "windows")) || env::var_os("NO_COLOR") .map(|t| !t.is_empty()) .unwrap_or(false)