Added `--keep-all`, as an alias for '--keep-last <inf>', as an option for borg-prune. Fixes #6656

This commit is contained in:
Michael Deyaso 2023-03-22 14:58:56 +03:00
parent 46f1cda204
commit e69fbe93c1
1 changed files with 8 additions and 1 deletions

View File

@ -79,7 +79,7 @@ class PruneMixIn:
self.print_error(
'At least one of the "keep-within", "keep-last", '
'"keep-secondly", "keep-minutely", "keep-hourly", "keep-daily", '
'"keep-weekly", "keep-monthly" or "keep-yearly" settings must be specified.'
'"keep-weekly", "keep-monthly", "keep-yearly" or "keep-all" settings must be specified.'
)
return self.exit_code
checkpoint_re = r"\.checkpoint(\.\d+)?"
@ -269,6 +269,13 @@ class PruneMixIn:
default=0,
help="number of secondly archives to keep",
)
subparser.add_argument(
"--keep-all",
dest="secondly",
action="store_const",
const=float("inf"),
help="keep all archives (alias of --keep-last=<infinite>)",
)
subparser.add_argument(
"--keep-minutely", dest="minutely", type=int, default=0, help="number of minutely archives to keep"
)