summaryrefslogtreecommitdiffstats
path: root/src/parse.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2023-11-06 13:08:56 -0500
committerTavian Barnes <tavianator@tavianator.com>2023-11-06 13:08:56 -0500
commit79aee58a4621d01c4b1e98c332775f3b87213ddb (patch)
treeebaa28d4abd07e7957b17e3dfcdf7ae33e3792c7 /src/parse.c
parent7d69fef6a0b80ad57acde7bac8a22b83531fec0d (diff)
downloadbfs-79aee58a4621d01c4b1e98c332775f3b87213ddb.tar.xz
Treat NO_COLOR="" the same as unset
The docs say > Command-line software which adds ANSI color to its output by default > should check for a NO_COLOR environment variable that, when present > and not an empty string (regardless of its value), prevents the > addition of ANSI color. but we were not checking for the empty string. Link: https://no-color.org/ Link: https://github.com/sharkdp/fd/pull/1421
Diffstat (limited to 'src/parse.c')
-rw-r--r--src/parse.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/parse.c b/src/parse.c
index 3f32021..09cfdd3 100644
--- a/src/parse.c
+++ b/src/parse.c
@@ -3670,7 +3670,8 @@ struct bfs_ctx *bfs_parse_cmdline(int argc, char *argv[]) {
}
enum use_color use_color = COLOR_AUTO;
- if (getenv("NO_COLOR")) {
+ const char *no_color = getenv("NO_COLOR");
+ if (no_color && *no_color) {
// https://no-color.org/
use_color = COLOR_NEVER;
}