btrbk: do not print help message if -q,--quiet is set

When called from another script, we dont want the help message printed
on errors. E.g. when running something like:

    btrbk list snapshots -q filter_which_does_not_match
pull/274/head
Axel Burri 2019-03-29 20:42:40 +01:00
parent 6d465da6dc
commit e3a81c8126
1 changed files with 3 additions and 1 deletions

4
btrbk
View File

@ -266,6 +266,7 @@ my $fake_uuid_prefix = 'XXXXXXXX-XXXX-XXXX-XXXX-'; # plus 0-padded inject_id: XX
my $dryrun; my $dryrun;
my $loglevel = 1; my $loglevel = 1;
my $quiet;
my $do_dumper; my $do_dumper;
my $show_progress = 0; my $show_progress = 0;
my $err = ""; my $err = "";
@ -304,6 +305,7 @@ sub VERSION_MESSAGE
sub HELP_MESSAGE sub HELP_MESSAGE
{ {
return if($quiet);
print STDERR <<"END_HELP"; print STDERR <<"END_HELP";
usage: btrbk [options] <command> [filter...] usage: btrbk [options] <command> [filter...]
@ -4457,7 +4459,7 @@ MAIN:
@tm_now = localtime($start_time); @tm_now = localtime($start_time);
my @config_override_cmdline; my @config_override_cmdline;
my ($config_cmdline, $quiet, $verbose, $preserve_snapshots, $preserve_backups, $wipe_snapshots, $skip_snapshots, $skip_backups, $print_schedule, $lockfile_cmdline); my ($config_cmdline, $preserve_snapshots, $preserve_backups, $wipe_snapshots, $skip_snapshots, $skip_backups, $print_schedule, $lockfile_cmdline);
my $resume_only_DEPRECATED; # as of btrbk-v0.26.0 my $resume_only_DEPRECATED; # as of btrbk-v0.26.0
unless(GetOptions( unless(GetOptions(
'help|h' => sub { VERSION_MESSAGE(); HELP_MESSAGE(0); exit 0; }, 'help|h' => sub { VERSION_MESSAGE(); HELP_MESSAGE(0); exit 0; },