btrbk: add empty_cell_char argument to print_formatted

pull/397/head
Axel Burri 2021-02-14 15:30:15 +01:00
parent f3eb1ecb95
commit 713fe50372
1 changed files with 2 additions and 2 deletions

4
btrbk
View File

@ -5059,6 +5059,7 @@ sub print_formatted(@)
my $ralign = $table_format->{RALIGN} // {}; my $ralign = $table_format->{RALIGN} // {};
my $fh = $args{outfile} // *STDOUT; my $fh = $args{outfile} // *STDOUT;
my $table_spacing = 2; my $table_spacing = 2;
my $empty_cell_char = $args{empty_cell_char} // "-";
if($format =~ s/^col:\s*(h:)?\s*//) { if($format =~ s/^col:\s*(h:)?\s*//) {
$args{no_header} = 1 if($1); $args{no_header} = 1 if($1);
@ -5120,8 +5121,7 @@ sub print_formatted(@)
$val = join(',', @{$val}); $val = join(',', @{$val});
} }
$print_row{$key} = 1 if(defined($val)); $print_row{$key} = 1 if(defined($val));
$val //= "-"; $val = $empty_cell_char if(!defined($val) || ($val eq ""));
$val = "-" if($val eq "");
$row->{$key} = $val; # write back the sanitized value $row->{$key} = $val; # write back the sanitized value
$maxlen{$key} = length($val) if($maxlen{$key} < length($val)); $maxlen{$key} = length($val) if($maxlen{$key} < length($val));
} }