Let config file and command line override NO_COLOR envvar

This commit is contained in:
Dennis Camera 2020-06-05 12:22:49 +02:00
parent cdb0d2be41
commit 89e48734bf
1 changed files with 4 additions and 6 deletions

View File

@ -256,14 +256,12 @@ class ColoredOutputOption(BooleanOption):
@staticmethod
def translate(val):
if 'NO_COLOR' in os.environ:
return False
elif isinstance(val, bool):
if isinstance(val, bool):
return val
elif val == 'auto':
return sys.stdout.isatty()
else:
elif val in configparser.ConfigParser.BOOLEAN_STATES:
return configparser.ConfigParser.BOOLEAN_STATES[val]
elif val == 'auto':
return 'NO_COLOR' not in os.environ and sys.stdout.isatty()
ColoredOutputOption.DEFAULT = ColoredOutputOption.translate(