Respect NO_COLOR environment variable to disable color output

This commit is contained in:
itchyny authored and Nico Williams committed 2023-07-19 00:05:41 -05:00
1 parent 87e3dfddb8
commit 0615d4982c
2 files changed
+29

No files matched your search

+5
View File
@@ -588,6 +588,11 @@ int main(int argc, char* argv[]) {
dumpopts |= JV_PRINT_COLOR;
}
#endif
if (dumpopts & JV_PRINT_COLOR) {
char *no_color = getenv("NO_COLOR");
if (no_color != NULL && no_color[0] != '\0')
dumpopts &= ~JV_PRINT_COLOR;
}
}
#endif
if (options & SORTED_OUTPUT) dumpopts |= JV_PRINT_SORTED;