colored header like values
[barcat.git] / barcat
diff --git a/barcat b/barcat
index db0aefa23fb370051399b502954972f388f39281..4f723569c04f91d581cd2dc26e0e69820e7aac38 100755 (executable)
--- a/barcat
+++ b/barcat
@@ -42,6 +42,7 @@ GetOptions(\%opt,
                        " (range expected)\n"
                );
        },
+       'header!',
        'markers|m=s',
        'graph-format=s' => sub {
                $opt{'graph-format'} = substr $_[1], 0, 1;
@@ -192,6 +193,14 @@ sub sival {
        );
 }
 
+say(
+       color(31), sprintf('%*s', $lenval, $minval),
+       color(90), '-', color(36), '+',
+       color(32), sprintf('%*s', $size * ($maxval - $minval) - 3, $maxval),
+       color(90), '-', color(36), '+',
+       color(0),
+) if $opt{header};
+
 while ($nr <= $#lines) {
        $nr >= $opt{hidemax} and last if defined $opt{hidemax};
        my $val = $values[$nr];
@@ -294,6 +303,10 @@ A string can indicate the starting position of a value
 or capture the numbers itself,
 for example I<-f'(\d+)'> for the first digits anywhere.
 
+=item --header
+
+Prepend a chart axis with minimum and maximum values labeled.
+
 =item -H, --human-readable
 
 Format values using SI unit prefixes,