- printf '%s total', color(1) . $opt{'value-format'}->($total) . color(0);
- printf ' in %d values', scalar @order;
- printf ' over %d lines', scalar @lines if @order != @lines;
- printf(' (%s min, %s avg, %s max)',
- color(31) . ($opt{reformat} ? $opt{'value-format'} : sub {$_[0]})->($order[-1]) . color(0),
- color(36) . ($opt{reformat} ? $opt{'value-format'} : $opt{'calc-format'})->($total / @order) . color(0),
- color(32) . ($opt{reformat} ? $opt{'value-format'} : sub {$_[0]})->($order[0]) . color(0),
- );
+ 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,
+ count => int @order,
+ lines => int @lines,
+ min => $order[-1],
+ max => $order[0],
+ avg => $total / @order,
+ });