Add support for NO_COLOR environment variable #835
Labels
No Label
bug
data loss
design finalized
good first issue
new feature area
question / support
security
waiting for response
No Milestone
No Assignees
3 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: borgmatic-collective/borgmatic#835
Loadingโฆ
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What I'd like to do and why
For details see:
https://no-color.org/
Other notes / implementation ideas
No response
Makes sense to me! In the meantime, check out these docs on disabling color if you haven't already.
Seems straightforward, I can do this.
@witten Should I give preference to
PY_COLORS
orNO_COLOR
in case both are set?Please refer to
should_do_markup
inlogger.py
.Good question! I'd recommend preferring
NO_COLOR
just because it seems a little more popular in a global GitHub search.Some related background reading is here: https://github.com/Textualize/rich/issues/343
Released in borgmatic 1.8.9!
Minor nitpick: if NO_COLOR is defined and empty it disables color while according to spec it should not:
The spec from no-color.org:
Command-line software which adds ANSI color to its output by default should check for a NO_COLOR environment variable that, when present and not an empty string (regardless of its value), prevents the addition of ANSI color.
Also, without color, lines are prefixed with some text (in that example:
ANSWER:borgmatic.actions.list
) not present with color. I suppose it is intended since -nc results in the same output but was a bit surprised to see these prefixes.Good catch! Thank you for pointing this out.
This has been fixed in main!
Thanks !
I created a PR to the no-color git repo, so borgmatic become listed on no-color.org:
https://github.com/jcs/no_color/pull/279
Awesome, thank you!