Browse Source

prune: more Highlander options, fixes #6269

Thomas Waldmann 2 years ago
parent
commit
1aae04e66e
1 changed files with 45 additions and 7 deletions
  1. 45 7
      src/borg/archiver/prune_cmd.py

+ 45 - 7
src/borg/archiver/prune_cmd.py

@@ -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)",
         )