feat: add hourly and keep_last option
This commit is contained in:
parent
5c33ccf0b1
commit
19ac9e55e5
|
@ -20,10 +20,13 @@ class Config:
|
|||
self.log_level = os.environ.get('LOG_LEVEL')
|
||||
|
||||
# forget / keep
|
||||
self.keep_last = os.environ.get('KEEP_LAST') or "7"
|
||||
self.keep_hourly = os.environ.get('KEEP_HOURLY') or "24"
|
||||
self.keep_daily = os.environ.get('KEEP_DAILY') or "7"
|
||||
self.keep_weekly = os.environ.get('KEEP_WEEKLY') or "4"
|
||||
self.keep_monthly = os.environ.get('KEEP_MONTHLY') or "12"
|
||||
self.keep_yearly = os.environ.get('KEEP_YEARLY') or "3"
|
||||
self.keep_tags = os.environ.get('KEEP_TAGS') or "keep"
|
||||
|
||||
if check:
|
||||
self.check()
|
||||
|
|
|
@ -75,11 +75,15 @@ def is_initialized(repository: str) -> bool:
|
|||
return commands.run(restic(repository, ["snapshots", '--last'])) == 0
|
||||
|
||||
|
||||
def forget(repository: str, daily: str, weekly: str, monthly: str, yearly: str):
|
||||
def forget(repository: str, keeplast: str, hourly: str, daily: str, weekly: str, monthly: str, yearly: str, tags: str):
|
||||
return commands.run(restic(repository, [
|
||||
'forget',
|
||||
'--group-by',
|
||||
'paths',
|
||||
'paths,tags',
|
||||
'-keep-last',
|
||||
keeplast,
|
||||
'--keep-hourly',
|
||||
hourly
|
||||
'--keep-daily',
|
||||
daily,
|
||||
'--keep-weekly',
|
||||
|
@ -88,6 +92,8 @@ def forget(repository: str, daily: str, weekly: str, monthly: str, yearly: str):
|
|||
monthly,
|
||||
'--keep-yearly',
|
||||
yearly,
|
||||
'--keep-tag',
|
||||
tags
|
||||
]))
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue