Closed bluss closed 8 months ago
The implementation was made before those specs were merged so I had to take a guess.
Hmm, they've made breaking changes to the spec, changing from value checks to presence checks. I strongly disagree with what they've changed it to but not really much to be done.
Compare
def has_colors():
if ((os.getenv("CLICOLOR", "1") != "0" and sys.stdout.isatty()) or
os.getenv("CLICOLOR_FORCE", "0") != "0"):
return True
else:
return False
with
def has_colors():
if "NO_COLOR" in os.environ:
return False
if "CLICOLOR_FORCE" in os.environ:
return True
return sys.stdout.isatty()
I don't have much of an opinion here, and I didn't know those specs 30 minutes ago - so no need to listen to me. I looked at them because they are linked in rustdoc. Now we know that there is this discrepancy.
This document https://bixense.com/clicolors/ says that NO_COLOR has precedence over CLICOLOR_FORCE, but the AutoStream implementation is the other way around.