From ceb4dbf19cec4d2ee3456c67c8f2778d9e156247 Mon Sep 17 00:00:00 2001 From: Axel Burri Date: Sat, 9 Apr 2016 14:16:14 +0200 Subject: [PATCH] btrbk: add --print-schedule command line option --- btrbk | 32 +++++++++++++++++--------------- doc/btrbk.1 | 14 ++++++++++---- 2 files changed, 27 insertions(+), 19 deletions(-) diff --git a/btrbk b/btrbk index 5079487..40bfb23 100755 --- a/btrbk +++ b/btrbk @@ -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; diff --git a/doc/btrbk.1 b/doc/btrbk.1 index 5d148b4..419ef7e 100644 --- a/doc/btrbk.1 +++ b/doc/btrbk.1 @@ -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 ] [\-t|\-\-table] [\-\-format ] - [\-\-progress] + [\-\-progress] [\-\-print\-schedule] [] .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