btrbk: add --print-schedule command line option

pull/88/head
Axel Burri 2016-04-09 14:16:14 +02:00
parent 78bfc5b885
commit ceb4dbf19c
2 changed files with 27 additions and 19 deletions

32
btrbk
View File

@ -153,7 +153,7 @@ my %table_formats = (
schedule => { table => [ qw( action host subvol scheme reason ) ],
long => [ qw( action host root_path subvol_path scheme reason ) ],
raw => [ qw( topic action url host path dow d m w) ],
raw => [ qw( topic action url host path dow d w m y) ],
},
usage => { table => [ qw( host path size used free ) ],
@ -223,6 +223,7 @@ sub HELP_MESSAGE
print STDERR " -l, --loglevel=LEVEL set logging level (warn, info, debug, trace)\n";
print STDERR " -t, --table change output to table format\n";
print STDERR " --format=FORMAT change output format, FORMAT=table|long|raw\n";
print STDERR " --print-schedule print scheduler details (for the \"run\" command)\n";
print STDERR " --progress show progress bar on send-receive operation\n";
print STDERR "\n";
print STDERR "commands:\n";
@ -2915,20 +2916,21 @@ MAIN:
my %config_override_opts;
my ($config_cmdline, $quiet, $verbose, $preserve_backups, $resume_only);
my ($config_cmdline, $quiet, $verbose, $preserve_backups, $resume_only, $print_schedule);
unless(GetOptions(
'help|h' => sub { VERSION_MESSAGE(); HELP_MESSAGE(0); exit 0; },
'version' => sub { VERSION_MESSAGE(); exit 0; },
'config|c=s' => \$config_cmdline,
'dry-run|n' => \$dryrun,
'preserve|p' => \$preserve_backups,
'resume-only|r' => \$resume_only,
'quiet|q' => \$quiet,
'verbose|v' => sub { $loglevel = 2; },
'loglevel|l=s' => \$loglevel,
'progress' => \$show_progress,
'table|t' => sub { $output_format = "table" },
'format=s' => \$output_format,
'help|h' => sub { VERSION_MESSAGE(); HELP_MESSAGE(0); exit 0; },
'version' => sub { VERSION_MESSAGE(); exit 0; },
'config|c=s' => \$config_cmdline,
'dry-run|n' => \$dryrun,
'preserve|p' => \$preserve_backups,
'resume-only|r' => \$resume_only,
'quiet|q' => \$quiet,
'verbose|v' => sub { $loglevel = 2; },
'loglevel|l=s' => \$loglevel,
'progress' => \$show_progress,
'table|t' => sub { $output_format = "table" },
'format=s' => \$output_format,
'print-schedule' => \$print_schedule,
# 'override=s' => \%config_override_opts, # e.g. --override=incremental=no
))
{
@ -4285,7 +4287,7 @@ MAIN:
#
# print scheduling results
#
if($loglevel >= 2) {
if($print_schedule) {
my @data = map { { %$_, vinfo_prefixed_keys("", $_->{value}) }; } @$schedule_results;
my @data_snapshot = grep { $_->{topic} eq "snapshot" } @data;
my @data_backup = grep { $_->{topic} eq "backup" } @data;

View File

@ -1,4 +1,4 @@
.TH "btrbk" "1" "2016-02-03" "btrbk v0.22.2" ""
.TH "btrbk" "1" "2016-04-09" "btrbk v0.23.0-dev" ""
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
@ -11,7 +11,7 @@ btrbk \- backup tool for btrfs volumes
[\-n|\-\-dry\-run] [\-p|\-\-preserve] [\-r|\-\-resume\-only]
[\-v|\-\-verbose] [\-q|\-\-quiet] [\-l|\-\-loglevel <level>]
[\-t|\-\-table] [\-\-format <output\-format>]
[\-\-progress]
[\-\-progress] [\-\-print\-schedule]
<command> [<args>]
.fi
.SH DESCRIPTION
@ -74,8 +74,7 @@ set to \[lq]yes\[rq] in the configuration file.
.PP
\-v, \-\-verbose
.RS 4
Verbose output. Sets "\-l info", and prints detailed scheduler
information on "run" and "dryrun" commands.
Verbose output (shortcut for "\-\-loglevel=info").
.RE
.PP
\-q, \-\-quiet
@ -107,6 +106,13 @@ commands. Useful for further exporting/scripting.
.RS 4
Show progress bar on send-receive operation.
.RE
.PP
\-\-print\-schedule
.RS 4
Print detailed scheduler information on "run" and "dryrun"
commands. Use the \fI\-\-format\fR command line option to switch
between different output formats.
.RE
.SH COMMANDS
.PP
.B run