Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add support for NO_COLOR
  • Loading branch information
Christoffer Rehn committed Jun 6, 2018
1 parent 6935504 commit 88cb015
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions kitten/__init__.py
Expand Up @@ -14,7 +14,7 @@
import fabric
from six.moves import range, queue

__version__ = "0.2.13"
__version__ = "0.2.14"

CHUNK_SIZE = 100
DEFAULT = {"threads": 10, "timeout": 10}
Expand Down Expand Up @@ -50,9 +50,9 @@ def ansi(x):


def colored(s, code=0, bold=False):
if sys.stdout.isatty():
return "{}{}{}{}".format(ansi(code), ansi(1) if bold else "", s, ansi(0))
return s
if not sys.stdout.isatty() or "NO_COLOR" in os.environ:
return s
return "{}{}{}{}".format(ansi(code), ansi(1) if bold else "", s, ansi(0))


def red(s):
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="kitten",
version="0.2.13",
version="0.2.14",
author="Chris Rehn",
author_email="chris@rehn.me",
description="Tiny multi-server automation tool.",
Expand Down

0 comments on commit 88cb015

Please sign in to comment.