From bd8bd393f24cbef158763fbc902e46fc6584477a Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Mon, 22 Jan 2024 12:40:48 -1000 Subject: [PATCH] ;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 ... --- bin/hledger-bar | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/hledger-bar b/bin/hledger-bar index 8a7e0d421..f61f3bf67 100755 --- a/bin/hledger-bar +++ b/bin/hledger-bar @@ -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=''