From: Mischa POSLAWSKY Date: Mon, 14 Nov 2022 15:42:11 +0000 (+0100) Subject: NO_COLOR environment as default --color X-Git-Tag: v1.09~20 X-Git-Url: http://git.shiar.net/barcat.git/commitdiff_plain/67c9562826ae187f403e11ef8e248644e79384f8 NO_COLOR environment as default --color Popular standard explained on: https://no-color.org/ --- diff --git a/barcat b/barcat index 62c1dbc..6ab610d 100755 --- a/barcat +++ b/barcat @@ -105,7 +105,7 @@ GetOptions(\%opt, } $opt{width} ||= $ENV{COLUMNS} || qx(tput cols) || 80 unless $opt{spark}; -$opt{color} //= -t *STDOUT; # enable on tty +$opt{color} //= $ENV{NO_COLOR} ? 0 : -t *STDOUT; # enable on tty $opt{'graph-format'} //= '-'; $opt{trim} *= $opt{width} / 100 if $opt{trimpct}; $opt{units} = [split //, ' kMGTPEZYyzafpn'.($opt{ascii} ? 'u' : 'μ').'m'] @@ -435,6 +435,8 @@ Input is always interpreted as UTF-8 and shown as is. Force colored output of values and bar markers. Defaults on if output is a tty, disabled otherwise such as when piped or redirected. +Can also be disabled by setting I<-C> +or the I environment variable. =item -f, --field=( | )