diff options
author | Florian Pritz <bluewind@xinu.at> | 2017-11-21 15:56:04 +0100 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2017-11-21 17:18:32 +0100 |
commit | 6b9c0d7719afdf85820e703e58b1358c95b6586e (patch) | |
tree | 54c5976f8c77f7930b5f314025e9472d25d939d1 /lib/App | |
parent | fe3bc18d25d204c799d42610078509f11954e1c2 (diff) | |
download | App-BorgRestore-6b9c0d7719afdf85820e703e58b1358c95b6586e.tar.gz App-BorgRestore-6b9c0d7719afdf85820e703e58b1358c95b6586e.tar.xz |
Enable --adhoc automatically when cache is empty
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'lib/App')
-rw-r--r-- | lib/App/BorgRestore.pm | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/App/BorgRestore.pm b/lib/App/BorgRestore.pm index edc009c..d96b957 100644 --- a/lib/App/BorgRestore.pm +++ b/lib/App/BorgRestore.pm @@ -235,6 +235,19 @@ method get_all_archives() { return \@ret; } +=head3 cache_contains_data + + if ($app->cache_contains_data()) { ... } + +Returns 1 if the cache contains any archive data, 0 otherwise. + +=cut + +method cache_contains_data() { + my $existing_archives = $self->{db}->get_archive_names(); + return @{$existing_archives}+0 > 0 ? 1 : 0; +} + =head3 select_archive_timespec my $archive = $app->select_archive_timespec($archives, $timespec); |