;fix: hledger-bar: detect non-interactive output properly for ANSI

This commit is contained in:
Simon Michael 2023-05-09 11:30:46 -10:00
parent 57c0205107
commit 705c1bec93

View File

@ -75,8 +75,9 @@ poschar="+"
# utils
# https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit and 24-bit colors:
if [[ $- != *i* || -v $NO_COLOR ]]; then
# 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 $NO_COLOR ]]; then
red=''
green=''
nocol=''