From 1aae04e66e0aeb0ddf0867dded48e42388b38bed Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Thu, 6 Apr 2023 17:10:16 +0200 Subject: [PATCH] prune: more Highlander options, fixes #6269 --- src/borg/archiver/prune_cmd.py | 52 +++++++++++++++++++++++++++++----- 1 file changed, 45 insertions(+), 7 deletions(-) diff --git a/src/borg/archiver/prune_cmd.py b/src/borg/archiver/prune_cmd.py index 1fae9e94b..55fb89d00 100644 --- a/src/borg/archiver/prune_cmd.py +++ b/src/borg/archiver/prune_cmd.py @@ -5,7 +5,7 @@ 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 @@ def build_parser_prune(self, subparsers, common_parser, mid_common_parser): metavar="INTERVAL", dest="within", type=interval, + action=Highlander, help="keep all archives within this time interval", ) subparser.add_argument( @@ -265,25 +266,61 @@ def build_parser_prune(self, subparsers, common_parser, mid_common_parser): 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 @@ def build_parser_prune(self, subparsers, common_parser, mid_common_parser): dest="checkpoint_interval", type=int, default=1800, + action=Highlander, help="write checkpoint every SECONDS seconds (Default: 1800)", )