Browse Source

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

Dan Helfman 4 months ago
parent
commit
1097a6576f

+ 1 - 1
borgmatic/actions/compact.py

@@ -37,7 +37,7 @@ def run_compact(
             global_arguments,
             global_arguments,
             local_path=local_path,
             local_path=local_path,
             remote_path=remote_path,
             remote_path=remote_path,
-            progress=compact_arguments.progress,
+            progress=compact_arguments.progress or config.get('progress'),
             cleanup_commits=compact_arguments.cleanup_commits,
             cleanup_commits=compact_arguments.cleanup_commits,
             threshold=compact_arguments.threshold,
             threshold=compact_arguments.threshold,
         )
         )

+ 1 - 1
borgmatic/actions/create.py

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

+ 1 - 1
borgmatic/actions/extract.py

@@ -45,5 +45,5 @@ def run_extract(
             remote_path=remote_path,
             remote_path=remote_path,
             destination_path=extract_arguments.destination,
             destination_path=extract_arguments.destination,
             strip_components=extract_arguments.strip_components,
             strip_components=extract_arguments.strip_components,
-            progress=extract_arguments.progress,
+            progress=extract_arguments.progress or config.get('progress'),
         )
         )

+ 3 - 2
borgmatic/borg/check.py

@@ -143,6 +143,7 @@ def check_archives(
     umask = config.get('umask')
     umask = config.get('umask')
     borg_exit_codes = config.get('borg_exit_codes')
     borg_exit_codes = config.get('borg_exit_codes')
     working_directory = borgmatic.config.paths.get_working_directory(config)
     working_directory = borgmatic.config.paths.get_working_directory(config)
+    progress = check_arguments.progress or config.get('progress')
 
 
     if 'data' in checks:
     if 'data' in checks:
         checks.add('archives')
         checks.add('archives')
@@ -170,7 +171,7 @@ def check_archives(
             + (('--log-json',) if global_arguments.log_json else ())
             + (('--log-json',) if global_arguments.log_json else ())
             + (('--lock-wait', str(lock_wait)) if lock_wait else ())
             + (('--lock-wait', str(lock_wait)) if lock_wait else ())
             + verbosity_flags
             + verbosity_flags
-            + (('--progress',) if check_arguments.progress else ())
+            + (('--progress',) if progress else ())
             + (tuple(extra_borg_options.split(' ')) if extra_borg_options else ())
             + (tuple(extra_borg_options.split(' ')) if extra_borg_options else ())
             + flags.make_repository_flags(repository_path, local_borg_version)
             + flags.make_repository_flags(repository_path, local_borg_version)
         )
         )
@@ -180,7 +181,7 @@ def check_archives(
             # The Borg repair option triggers an interactive prompt, which won't work when output is
             # The Borg repair option triggers an interactive prompt, which won't work when output is
             # captured. And progress messes with the terminal directly.
             # captured. And progress messes with the terminal directly.
             output_file=(
             output_file=(
-                DO_NOT_CAPTURE if check_arguments.repair or check_arguments.progress else None
+                DO_NOT_CAPTURE if check_arguments.repair or progress else None
             ),
             ),
             environment=environment.make_environment(config),
             environment=environment.make_environment(config),
             working_directory=working_directory,
             working_directory=working_directory,

+ 1 - 1
borgmatic/borg/transfer.py

@@ -56,7 +56,7 @@ def transfer_archives(
     return execute_command(
     return execute_command(
         full_command,
         full_command,
         output_log_level=logging.ANSWER,
         output_log_level=logging.ANSWER,
-        output_file=DO_NOT_CAPTURE if transfer_arguments.progress else None,
+        output_file=DO_NOT_CAPTURE if (transfer_arguments.progress or config.get('progress')) else None,
         environment=environment.make_environment(config),
         environment=environment.make_environment(config),
         working_directory=borgmatic.config.paths.get_working_directory(config),
         working_directory=borgmatic.config.paths.get_working_directory(config),
         borg_local_path=local_path,
         borg_local_path=local_path,

+ 1 - 0
borgmatic/commands/arguments.py

@@ -305,6 +305,7 @@ DEFAULT_FALSE_FLAG_NAMES = {
     'healthchecks.create_slug',
     'healthchecks.create_slug',
     'repositories[0].append_only',
     'repositories[0].append_only',
     'repositories[0].make_parent_dirs',
     'repositories[0].make_parent_dirs',
+    'progress',
 }
 }
 
 
 
 

+ 6 - 0
borgmatic/config/schema.yaml

@@ -793,6 +793,12 @@ properties:
             Apply color to console output. Can be overridden with --no-color
             Apply color to console output. Can be overridden with --no-color
             command-line flag. Defaults to true.
             command-line flag. Defaults to true.
         example: false
         example: false
+    progress:
+        type: boolean
+        description: |
+            Display progress as each file or archive is processed. Defaults to
+            false.
+        example: true
     skip_actions:
     skip_actions:
         type: array
         type: array
         items:
         items: