From 7501d4d563e38bd7da442f69271ab28a48a46ee3 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Sun, 11 Jun 2017 16:12:47 +0200 Subject: Add --version option Signed-off-by: Florian Pritz --- README.md | 4 ++++ script/borg-restore.pl | 11 ++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0e6e7c1..4c4cc9d 100644 --- a/README.md +++ b/README.md @@ -85,6 +85,10 @@ It can be used to build your own restoration script. extract. Using this option will show all archives that borg knows about, even if they do not contain the file that shall be restored. +- **--version** + + Output the program version. + # CONFIGURATION For configuration options please see [App::BorgRestore::Settings](https://metacpan.org/pod/App::BorgRestore::Settings). diff --git a/script/borg-restore.pl b/script/borg-restore.pl index f6299ca..0987c33 100755 --- a/script/borg-restore.pl +++ b/script/borg-restore.pl @@ -93,6 +93,10 @@ yet and you want to restore a file without having to manually call borg extract. Using this option will show all archives that borg knows about, even if they do not contain the file that shall be restored. +=item B<--version> + +Output the program version. + =back =head1 CONFIGURATION @@ -206,9 +210,14 @@ 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") or pod2usage(2); + GetOptions(\%opts, "help|h", "debug", "update-cache|u", "destination|d=s", "time|t=s", "adhoc", "version") or pod2usage(2); pod2usage(0) if $opts{help}; + if ($opts{version}) { + printf "Version: %s\n", $App::BorgRestore::VERSION; + return 0; + } + pod2usage(-verbose => 0) if (@ARGV== 0 and !$opts{"update-cache"}); if ($opts{debug}) { -- cgit v1.2.3-24-g4f1b