From 8d1dc148fa2c0bb70993651554de7e7ebc34d9ba Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Thu, 2 Aug 2018 14:20:17 +0200 Subject: Add --quiet Signed-off-by: Florian Pritz --- README.md | 5 +++++ script/borg-restore.pl | 12 +++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index da4e10c..af1930e 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,7 @@ borg-restore.pl \[options\] <path> Options: --help, -h short help message --debug show debug messages + --quiet show only warnings and errors --update-cache, -u update cache files --list [pattern] List paths contained in the backups, optionally matching an SQLite LIKE pattern @@ -63,6 +64,10 @@ It can be used to build your own restoration script. Enable debug messages. +- **--quiet** + + Reduce output by showing only show warnings and above (errors). + - **--update-cache**, **-u** Update the lookup database. You should run this after creating or removing a backup. diff --git a/script/borg-restore.pl b/script/borg-restore.pl index dcf6166..24dd735 100755 --- a/script/borg-restore.pl +++ b/script/borg-restore.pl @@ -13,6 +13,7 @@ borg-restore.pl [options] Options: --help, -h short help message --debug show debug messages + --quiet show only warnings and errors --update-cache, -u update cache files --list [pattern] List paths contained in the backups, optionally matching an SQLite LIKE pattern @@ -71,6 +72,10 @@ Show help message. Enable debug messages. +=item B<--quiet> + +Reduce output by showing only show warnings and above (errors). + =item B<--update-cache>, B<-u> Update the lookup database. You should run this after creating or removing a backup. @@ -219,7 +224,7 @@ sub main { $ENV{PATH} = App::BorgRestore::Helper::untaint($ENV{PATH}, qr(.*)); Getopt::Long::Configure ("bundling"); - GetOptions(\%opts, "help|h", "debug", "update-cache|u", "destination|d=s", "time|t=s", "adhoc", "version", "list") or pod2usage(2); + GetOptions(\%opts, "help|h", "debug", "update-cache|u", "destination|d=s", "time|t=s", "adhoc", "version", "list", "quiet") or pod2usage(2); pod2usage(0) if $opts{help}; if ($opts{version}) { @@ -229,6 +234,11 @@ sub main { pod2usage(-verbose => 0) if (@ARGV== 0 and !$opts{"update-cache"} and !$opts{"list"}); + if ($opts{quiet}) { + my $logger = Log::Log4perl->get_logger(''); + $logger->level($WARN); + } + if ($opts{debug}) { my $logger = Log::Log4perl->get_logger(''); $logger->level($DEBUG); -- cgit v1.2.3-24-g4f1b