-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
libtextstyle: Support the NO_COLOR environment variable.
It follows the specification at https://no-color.org/. The support is in the example programs, not in the function styled_ostream_create, so that it can be overridden through the command-line option --color=always. We only test whether the environment variable is set, not whether its value is non-empty. POSIX-specified environment variables are treated like unset when their value is empty; this is because in the old days it was not possible to unset an environment variable. But nowadays: - all shells support the 'unset' built-in, - all platforms that have the setenv() function also have the unsetenv() function, and - the 'env' program from GNU coreutils supports --unset=VARIABLE to unset a variable. This makes it possible to unset an environment variable that is set by the parent process. * libtextstyle/adhoc-tests/hello.c (main): Do not emit styling when the environment variable NO_COLOR is set. * libtextstyle/examples/color-filter/filter.c (main): Likewise. * libtextstyle/examples/color-hello/hello.c (main): Likewise. * gettext-tools/src/write-catalog.c (msgdomain_list_print): Likewise. * libtextstyle/doc/libtextstyle.texi (The NO_COLOR variable): New section. * libtextstyle/NEWS: Mention it.
- Loading branch information
Showing
6 changed files
with
30 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters