Selaa lähdekoodia

Add "stats" option to configuration (#303).

Dan Helfman 3 kuukautta sitten
vanhempi
sitoutus
3e21cdb579
3 muutettua tiedostoa jossa 11 lisäystä ja 3 poistoa
  1. 1 1
      borgmatic/actions/create.py
  2. 3 2
      borgmatic/borg/prune.py
  3. 7 0
      borgmatic/config/schema.yaml

+ 1 - 1
borgmatic/actions/create.py

@@ -328,7 +328,7 @@ def run_create(
             local_path=local_path,
             remote_path=remote_path,
             progress=create_arguments.progress or config.get('progress'),
-            stats=create_arguments.stats,
+            stats=create_arguments.stats or config.get('stats'),
             json=create_arguments.json,
             list_files=create_arguments.list_files,
             stream_processes=stream_processes,

+ 3 - 2
borgmatic/borg/prune.py

@@ -66,6 +66,7 @@ def prune_archives(
     borgmatic.logger.add_custom_log_levels()
     umask = config.get('umask', None)
     lock_wait = config.get('lock_wait', None)
+    stats = prune_arguments.stats or config.get('stats')
     extra_borg_options = config.get('extra_borg_options', {}).get('prune', '')
 
     full_command = (
@@ -77,7 +78,7 @@ def prune_archives(
         + (('--lock-wait', str(lock_wait)) if lock_wait else ())
         + (
             ('--stats',)
-            if prune_arguments.stats
+            if stats
             and not dry_run
             and not feature.available(feature.Feature.NO_PRUNE_STATS, local_borg_version)
             else ()
@@ -94,7 +95,7 @@ def prune_archives(
         + flags.make_repository_flags(repository_path, local_borg_version)
     )
 
-    if prune_arguments.stats or prune_arguments.list_archives:
+    if stats or prune_arguments.list_archives:
         output_log_level = logging.ANSWER
     else:
         output_log_level = logging.INFO

+ 7 - 0
borgmatic/config/schema.yaml

@@ -816,6 +816,13 @@ properties:
             false.
         default: false
         example: true
+    stats:
+        type: boolean
+        description: |
+            Display statistics of an archive when running supported actions.
+            Defaults to false.
+        default: false
+        example: true
     skip_actions:
         type: array
         items: