Skip to content

Commit

Permalink
feat: add support for NO_COLOR
Browse files Browse the repository at this point in the history
  • Loading branch information
SethFalco authored and kbdharun committed Oct 19, 2023
1 parent 41ea9cf commit 804f408
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/tldr.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,14 @@ int main(int argc, char **argv) {
print_usage(argv[0]);
return EXIT_FAILURE;
}
color_flag = isatty(fileno(stdout));

char *no_color = getenv("NO_COLOR");
if (no_color == NULL || no_color[0] == '\0') {
color_flag = isatty(fileno(stdout));
} else {
color_flag = 0;
}

while (1) {
option_index = 0;
c = getopt_long_only(argc, argv, "v", long_options, &option_index);
Expand Down

0 comments on commit 804f408

Please sign in to comment.