prune: more Highlander options, fixes #6269

This commit is contained in:
Thomas Waldmann 2023-04-06 17:10:16 +02:00
parent 645b0088c5
commit 1aae04e66e
No known key found for this signature in database
GPG Key ID: 243ACFA951F78E01
1 changed files with 45 additions and 7 deletions

View File

@ -5,7 +5,7 @@ import logging
from operator import attrgetter
import re
from ._common import with_repository
from ._common import with_repository, Highlander
from ..archive import Archive, Statistics
from ..cache import Cache
from ..constants import * # NOQA
@ -257,6 +257,7 @@ class PruneMixIn:
metavar="INTERVAL",
dest="within",
type=interval,
action=Highlander,
help="keep all archives within this time interval",
)
subparser.add_argument(
@ -265,25 +266,61 @@ class PruneMixIn:
dest="secondly",
type=int,
default=0,
action=Highlander,
help="number of secondly archives to keep",
)
subparser.add_argument(
"--keep-minutely", dest="minutely", type=int, default=0, help="number of minutely archives to keep"
"--keep-minutely",
dest="minutely",
type=int,
default=0,
action=Highlander,
help="number of minutely archives to keep",
)
subparser.add_argument(
"-H", "--keep-hourly", dest="hourly", type=int, default=0, help="number of hourly archives to keep"
"-H",
"--keep-hourly",
dest="hourly",
type=int,
default=0,
action=Highlander,
help="number of hourly archives to keep",
)
subparser.add_argument(
"-d", "--keep-daily", dest="daily", type=int, default=0, help="number of daily archives to keep"
"-d",
"--keep-daily",
dest="daily",
type=int,
default=0,
action=Highlander,
help="number of daily archives to keep",
)
subparser.add_argument(
"-w", "--keep-weekly", dest="weekly", type=int, default=0, help="number of weekly archives to keep"
"-w",
"--keep-weekly",
dest="weekly",
type=int,
default=0,
action=Highlander,
help="number of weekly archives to keep",
)
subparser.add_argument(
"-m", "--keep-monthly", dest="monthly", type=int, default=0, help="number of monthly archives to keep"
"-m",
"--keep-monthly",
dest="monthly",
type=int,
default=0,
action=Highlander,
help="number of monthly archives to keep",
)
subparser.add_argument(
"-y", "--keep-yearly", dest="yearly", type=int, default=0, help="number of yearly archives to keep"
"-y",
"--keep-yearly",
dest="yearly",
type=int,
default=0,
action=Highlander,
help="number of yearly archives to keep",
)
define_archive_filters_group(subparser, sort_by=False, first_last=False)
subparser.add_argument(
@ -293,5 +330,6 @@ class PruneMixIn:
dest="checkpoint_interval",
type=int,
default=1800,
action=Highlander,
help="write checkpoint every SECONDS seconds (Default: 1800)",
)