btrbk: bugfix: action "config print": correctly handle undef options; skip deprecated options

pull/88/head
Axel Burri 2016-04-18 20:42:53 +02:00
parent 2317580639
commit 2c3997ad0a
1 changed files with 11 additions and 8 deletions

7
btrbk
View File

@ -48,7 +48,7 @@ use Getopt::Long qw(GetOptions);
use POSIX qw(strftime); use POSIX qw(strftime);
use Data::Dumper; use Data::Dumper;
our $VERSION = "0.23.0-rc1"; our $VERSION = "0.23.0-dev";
our $AUTHOR = 'Axel Burri <axel@tty0.ch>'; our $AUTHOR = 'Axel Burri <axel@tty0.ch>';
our $PROJECT_HOME = '<http://digint.ch/btrbk/>'; our $PROJECT_HOME = '<http://digint.ch/btrbk/>';
@ -2118,6 +2118,7 @@ sub config_dump_keys($;@)
foreach my $key (sort keys %config_options) foreach my $key (sort keys %config_options)
{ {
my $val; my $val;
next if($config_options{$key}->{deprecated});
if($opts{resolve}) { if($opts{resolve}) {
$val = config_key($config, $key); $val = config_key($config, $key);
} else { } else {
@ -2132,6 +2133,7 @@ sub config_dump_keys($;@)
next; # both undef, skip next; # both undef, skip
} }
} }
if(defined($val)) {
if($config_options{$key}->{accept_preserve_matrix}) { if($config_options{$key}->{accept_preserve_matrix}) {
$val = format_preserve_matrix($val); $val = format_preserve_matrix($val);
} }
@ -2139,7 +2141,8 @@ sub config_dump_keys($;@)
my $val2 = join(',', @$val); my $val2 = join(',', @$val);
$val = $val2; $val = $val2;
} }
$val //= "<unset>"; }
$val //= exists($config->{$key}) ? "no" : "<unset>";
my $len = length($key); my $len = length($key);
$maxlen = $len if($len > $maxlen); $maxlen = $len if($len > $maxlen);
push @ret, { key => $key, val => $val, len => $len }; push @ret, { key => $key, val => $val, len => $len };