btrbk: cosmetics on table format: no trailing whitespace

pull/57/head
Axel Burri 2015-10-13 01:39:58 +02:00
parent fa382d5e6d
commit 282668927d
1 changed files with 9 additions and 2 deletions

11
btrbk
View File

@ -1841,14 +1841,21 @@ sub print_formatted(@)
}
# print keys (headings)
print join(" ", map { $_ . (' ' x ($maxlen{$_} - length($_))) } @$keys) . "\n";
my $fill = '';
foreach (@$keys) {
print $fill . $_;
$fill = ' ' x (2 + $maxlen{$_} - length($_));
}
print "\n";
print join(" ", map { '-' x ($maxlen{$_}) } @$keys) . "\n";
# print values
foreach my $row (@$data) {
my $fill = '';
foreach (@$keys) {
my $val = $row->{$_};
print $val . (' ' x (2 + $maxlen{$_} - length($val)));
print $fill . $val;
$fill = ' ' x (2 + $maxlen{$_} - length($val));
}
print "\n";
}