;fix:hledger-bar: really fix the error when NO_COLOR is not defined [#2159]
Also, it's now more compliant with the no-color.org spec: 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. so one can now temporarily override $NO_COLOR=1 in the environment by setting it empty: NO_COLOR= hledger ...
This commit is contained in:
parent
0f30316cfd
commit
bd8bd393f2
@ -78,7 +78,7 @@ poschar="+"
|
||||
|
||||
# https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit and 24-bit colors.
|
||||
# Disable if stdout is not a terminal or NO_COLOR is defined.
|
||||
if [[ ! -t 1 || -v ]]; then
|
||||
if [[ ! -t 1 || $NO_COLOR ]]; then
|
||||
red=''
|
||||
green=''
|
||||
nocol=''
|
||||
|
||||
Loading…
Reference in New Issue
Block a user