Skip to content

Commit

Permalink
Don't colour output if NO_COLOR is set (#163)
Browse files Browse the repository at this point in the history
This follows the informal standard defined at https://no-color.org,
allowing users who don't want colour output from command line
applications to set a single environment variable to disable it in all
supported applications.
  • Loading branch information
srstevenson authored and theacodes committed Jan 2, 2019
1 parent 734d053 commit b673717
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion docs/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,8 @@ Controlling color output

By default, Nox will output colorful logs if you're using in an interactive
terminal. However, if you are redirecting ``stderr`` to a file or otherwise
not using an interactive terminal, nox will output in plaintext.
not using an interactive terminal, or the environment variable ``NO_COLOR`` is
set, nox will output in plaintext.

You can manually control Nox's output using the ``--nocolor`` and ``--forcecolor`` flags.

Expand Down
2 changes: 1 addition & 1 deletion nox/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ def main():

secondary.add_argument(
"--nocolor",
default=not sys.stderr.isatty(),
default="NO_COLOR" in os.environ or not sys.stderr.isatty(),
action="store_true",
help="Disable all color output.",
)
Expand Down

0 comments on commit b673717

Please sign in to comment.