git.shiar.nl
/
barcat.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
enable lexical subs before perl v5.26
[barcat.git]
/
graph
diff --git
a/graph
b/graph
index ab51d0877dc49ac9517161ed92ddd7b7427450a2..307c9e41d47bfc031ad0e897ee120d4c9c3a19f4 100755
(executable)
--- a/
graph
+++ b/
graph
@@
-1,9
+1,10
@@
#!/usr/bin/env perl
#!/usr/bin/env perl
-use 5.01
4
;
+use 5.01
8
;
use warnings;
use utf8;
use List::Util qw( min max sum );
use open qw( :std :utf8 );
use warnings;
use utf8;
use List::Util qw( min max sum );
use open qw( :std :utf8 );
+use experimental qw( lexical_subs );
our $VERSION = '1.02';
our $VERSION = '1.02';
@@
-17,6
+18,7
@@
GetOptions(\my %opt,
'follow|f:i',
'trim|length|l=i',
'markers|m=s',
'follow|f:i',
'trim|length|l=i',
'markers|m=s',
+ 'unmodified|u!',
'width|w=i',
'usage|h' => sub { podexit() },
'help' => sub { podexit(-verbose => 2) },
'width|w=i',
'usage|h' => sub { podexit() },
'help' => sub { podexit(-verbose => 2) },
@@
-38,8
+40,9
@@
$SIG{INT} = 'IGNORE'; # continue after assumed eof
my (@lines, @values);
while (readline) {
my (@lines, @values);
while (readline) {
- chomp;
- push @values, s/^\h* ( -? [0-9]* (?:\.[0-9]+)? )//x && $1;
+ s/\r?\n\z//;
+ s/^\h*// unless $opt{unmodified};
+ push @values, s/^ ( \h* -? [0-9]* \.? [0-9]+ |)//x && $1;
if (defined $opt{trim}) {
my $trimpos = abs $opt{trim};
if ($trimpos <= 1) {
if (defined $opt{trim}) {
my $trimpos = abs $opt{trim};
if ($trimpos <= 1) {
@@
-51,13
+54,13
@@
while (readline) {
}
push @lines, $_;
}
}
push @lines, $_;
}
-@lines or exit;
$SIG{INT} = 'DEFAULT';
sub show_lines {
state $nr = 0;
$SIG{INT} = 'DEFAULT';
sub show_lines {
state $nr = 0;
+@lines and @lines > $nr or return;
my @order = sort { $b <=> $a } grep { length } @values;
my $maxval = $order[0];
my @order = sort { $b <=> $a } grep { length } @values;
my $maxval = $order[0];
@@
-183,6
+186,11
@@
or 68% of all entries.
=back
=back
+=item -u, --unmodified
+
+Do not strip leading whitespace.
+Keep original value alignment, which may be significant in some programs.
+
=item -w, --width=<columns>
Override the maximum number of columns to use.
=item -w, --width=<columns>
Override the maximum number of columns to use.
@@
-217,7
+225,7
@@
Number of HTTP requests per day:
Any kind of database query with leading counts:
echo 'SELECT count(*),schemaname FROM pg_tables GROUP BY 2' |
Any kind of database query with leading counts:
echo 'SELECT count(*),schemaname FROM pg_tables GROUP BY 2' |
- psql -t | graph
+ psql -t | graph
-u
Git statistics, such commit count by year:
Git statistics, such commit count by year: