git.shiar.nl
/
barcat.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
t: strip options from input file names
[barcat.git]
/
barcat
diff --git
a/barcat
b/barcat
index c5b7e0af73580e4a1015feed224d281dcdb9ef84..9cfe3e3df3330b69a2f762372e76ee2af606db54 100755
(executable)
--- a/
barcat
+++ b/
barcat
@@
-35,7
+35,7
@@
GetOptions(\%opt,
'hidemax=i',
'minval=f',
'maxval=f',
'hidemax=i',
'minval=f',
'maxval=f',
- 'limit|L
=
s' => sub {
+ 'limit|L
:
s' => sub {
my ($optname, $optval) = @_;
$optval ||= 0;
($opt{hidemin}, $opt{hidemax}) =
my ($optname, $optval) = @_;
$optval ||= 0;
($opt{hidemin}, $opt{hidemax}) =
@@
-236,9
+236,13
@@
while ($nr <= $#lines) {
$nr >= $opt{hidemax} and last if defined $opt{hidemax};
my $val = $values[$nr];
my $rel = length $val && ($val - $minval) / ($maxval - $minval);
$nr >= $opt{hidemax} and last if defined $opt{hidemax};
my $val = $values[$nr];
my $rel = length $val && ($val - $minval) / ($maxval - $minval);
+ my $color = !length $val || !$opt{palette} ? undef :
+ $val == $order[0] ? $opt{palette}->[-1] : # max
+ $val == $order[-1] ? $opt{palette}->[0] : # min
+ $opt{palette}->[ $rel * ($#{$opt{palette}} - 1) + 1 ];
if ($opt{spark}) {
if ($opt{spark}) {
- print $opt{spark}->[
+ print
color($color),
$opt{spark}->[
!$val ? 0 : # blank
$val == $order[0] ? -1 : # max
$val == $order[-1] ? 1 : # min
!$val ? 0 : # blank
$val == $order[0] ? -1 : # max
$val == $order[-1] ? 1 : # min
@@
-249,10
+253,6
@@
while ($nr <= $#lines) {
}
if (length $val) {
}
if (length $val) {
- my $color = !$opt{palette} ? undef :
- $val == $order[0] ? $opt{palette}->[-1] : # max
- $val == $order[-1] ? $opt{palette}->[0] : # min
- $opt{palette}->[ $rel * ($#{$opt{palette}} - 1) + 1 ];
$val = $opt{units} ? sival($val) : sprintf "%*s", $lenval, $val;
color($color) for $val;
}
$val = $opt{units} ? sival($val) : sprintf "%*s", $lenval, $val;
color($color) for $val;
}
@@
-367,7
+367,7
@@
unless C<--length=0>.
Prepend a dash (i.e. make negative) to enforce padding
regardless of encountered contents.
Prepend a dash (i.e. make negative) to enforce padding
regardless of encountered contents.
-=item -L, --limit
=(<count>|<start>-[<end>])
+=item -L, --limit
[=(<count> | <start>-[<end>])]
Stop output after a number of lines.
All input is still counted and analyzed for statistics,
Stop output after a number of lines.
All input is still counted and analyzed for statistics,