use Getopt::Long '2.33';
sub podexit { require Pod::Usage; Pod::Usage::pod2usage(-exitval => 0, @_) }
GetOptions(\my %opt,
+ 'color|c!',
'width|w=i',
'usage|h' => sub { podexit() },
'help' => sub { podexit(-verbose => 2) },
) or exit 64; # EX_USAGE
$opt{width} ||= $ENV{COLUMNS} || 80;
+$opt{color} //= 1;
my @lines = readline or exit;
chomp for @lines;
my @barmark;
$barmark[ sum(@values) / @values * $size ] = '='; # average
$barmark[ orderpos($#order / 2) ] = '+'; # mean
-defined and $_ = "\e[36m$_\e[0m" for @barmark;
+defined and $opt{color} and $_ = "\e[36m$_\e[0m" for @barmark;
for my $nr (0 .. $#lines) {
my $val = $values[$nr];
- my $color =
+ my $color = !$opt{color} ? 0 :
$val == $order[0] ? 32 : # max
$val == $order[-1] ? 31 : # min
90;
=over
+=item --no-color
+
+Disable colored output of values and bar markers.
+
=item -w, --width=<columns>
Override the maximum number of columns to use.