src/backup/prune.rs: add new helper keeps_something()

This commit is contained in:
Dietmar Maurer
2019-12-06 12:28:31 +01:00
parent 4bf0cc3b41
commit 9e3f008804
2 changed files with 18 additions and 17 deletions

View File

@ -113,6 +113,16 @@ impl PruneOptions {
self.keep_yearly = value;
self
}
pub fn keeps_something(&self) -> bool {
let mut keep_something = false;
if let Some(count) = self.keep_last { if count > 0 { keep_something = true; } }
if let Some(count) = self.keep_daily { if count > 0 { keep_something = true; } }
if let Some(count) = self.keep_weekly { if count > 0 { keep_something = true; } }
if let Some(count) = self.keep_monthly { if count > 0 { keep_something = true; } }
if let Some(count) = self.keep_yearly { if count > 0 { keep_something = true; } }
keep_something
}
}
pub fn compute_prune_info(