Repository: sharkdp/fd (language: rust)

Issue:
NO_COLOR support
Hello. Lovely tool. 

I find myself doing a bunch of `fd whatever | cat` to strip out colors.

Would be lovely to have support for [NO_COLOR](https://no-color.org/)! Would give users are more consistent way to control this behavior.

Lovely tool. Played with it briefly a while back but after a [recent mention](https://mobile.twitter.com/dimfeld/status/1232468670367948800) from @dimfeld I've been using it quite consistently. It alleviated my specific gripe, which was ripgrep being ridiculously faster than find & needing less filtering after. Thanks ever much.


Discussion / hints:
Thank you for the feedback!

> I find myself doing a bunch of fd whatever | cat to strip out colors.

Why? Simply because you don't like the colorized output? Note that the ANSI escape codes auto-disable when you pipe to another process.

Also, have you seen that colors can be deactivated using `--color=never`?

> Would be lovely to have support for [NO_COLOR](https://no-color.org/)! Would give users are more consistent way to control this behavior.

Sounds good to me.

Fix patch:
diff --git a/README.md b/README.md
index f2d5d9cb9..ee0ce9965 100644
--- a/README.md
+++ b/README.md
@@ -97,6 +97,8 @@ complete (and more colorful) variants, see
 [here](https://github.com/seebi/dircolors-solarized) or
 [here](https://github.com/trapd00r/LS_COLORS).
 
+`fd` also honors the [NO_COLOR](https://no-color.org/) environment variable.
+
 ## Parallel command execution
 If the `-x`/`--exec` option is specified alongside a command template, a job pool will be created
 for executing commands in parallel for each discovered path as the input. The syntax for generating
diff --git a/src/main.rs b/src/main.rs
index 243b8c6e9..49e35eba3 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -143,7 +143,7 @@ fn main() {
     let colored_output = match matches.value_of("color") {
         Some("always") => true,
         Some("never") => false,
-        _ => atty::is(Stream::Stdout),
+        _ => env::var_os("NO_COLOR").is_none() && atty::is(Stream::Stdout),
     };
 
     let path_separator = matches.value_of("path-separator").map(|str| str.to_owned());


Test patch: