git.shiar.nl
/
barcat.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
report variables unformatted on trailing #
[barcat.git]
/
barcat
diff --git
a/barcat
b/barcat
index e02ce4ed09e9c7f47f53e00a7eda3801cb8fdc47..a86f74f4343bf3676e8b771a1e7ea4804a55c831 100755
(executable)
--- a/
barcat
+++ b/
barcat
@@
-365,8
+365,8
@@
sub show_stat {
}
if (@order) {
my $total = sum @order;
}
if (@order) {
my $total = sum @order;
- my $fmt = '${sum;color(1)} total in ${count} values';
- $fmt .= ' over ${lines} lines' if @order != @lines;
+ my $fmt = '${sum;color(1)} total in ${count
#
} values';
+ $fmt .= ' over ${lines
#
} lines' if @order != @lines;
$fmt .= " ($_)" for $opt{report} || ();
print varfmt($fmt, {
sum => $total,
$fmt .= " ($_)" for $opt{report} || ();
print varfmt($fmt, {
sum => $total,
@@
-385,9
+385,10
@@
sub varfmt {
my ($fmt, $vars) = @_;
$fmt =~ s[\$\{( (?: [^{}]++ | \{(?1)\} )+ )\}]{
my ($name, $cmd) = split /\s*;/, $1, 2;
my ($fmt, $vars) = @_;
$fmt =~ s[\$\{( (?: [^{}]++ | \{(?1)\} )+ )\}]{
my ($name, $cmd) = split /\s*;/, $1, 2;
+ my $format = $name !~ s/\h*\#// && $opt{reformat};
local $_ = $vars->{$name};
if (defined) {
local $_ = $vars->{$name};
if (defined) {
- $_ = $opt{'value-format'}->($_) if $
opt{reformat}
;
+ $_ = $opt{'value-format'}->($_) if $
format
;
if ($cmd) {
eval $cmd;
warn "Error in \$$name report: $@" if $@;
if ($cmd) {
eval $cmd;
warn "Error in \$$name report: $@" if $@;