From 1097a6576f48e7d06482dadc97182c2eed4ff4bd Mon Sep 17 00:00:00 2001 From: Dan Helfman Date: Wed, 19 Mar 2025 11:06:36 -0700 Subject: [PATCH] Add "progress" option to configuration (#303). --- borgmatic/actions/compact.py | 2 +- borgmatic/actions/create.py | 2 +- borgmatic/actions/extract.py | 2 +- borgmatic/borg/check.py | 5 +++-- borgmatic/borg/transfer.py | 2 +- borgmatic/commands/arguments.py | 1 + borgmatic/config/schema.yaml | 6 ++++++ 7 files changed, 14 insertions(+), 6 deletions(-) diff --git a/borgmatic/actions/compact.py b/borgmatic/actions/compact.py index a8ab6a6f..1a0cea3d 100644 --- a/borgmatic/actions/compact.py +++ b/borgmatic/actions/compact.py @@ -37,7 +37,7 @@ def run_compact( global_arguments, local_path=local_path, remote_path=remote_path, - progress=compact_arguments.progress, + progress=compact_arguments.progress or config.get('progress'), cleanup_commits=compact_arguments.cleanup_commits, threshold=compact_arguments.threshold, ) diff --git a/borgmatic/actions/create.py b/borgmatic/actions/create.py index ecc688b5..c12bf43e 100644 --- a/borgmatic/actions/create.py +++ b/borgmatic/actions/create.py @@ -327,7 +327,7 @@ def run_create( borgmatic_runtime_directory, local_path=local_path, remote_path=remote_path, - progress=create_arguments.progress, + progress=create_arguments.progress or config.get('progress'), stats=create_arguments.stats, json=create_arguments.json, list_files=create_arguments.list_files, diff --git a/borgmatic/actions/extract.py b/borgmatic/actions/extract.py index 6e2e7900..83f81176 100644 --- a/borgmatic/actions/extract.py +++ b/borgmatic/actions/extract.py @@ -45,5 +45,5 @@ def run_extract( remote_path=remote_path, destination_path=extract_arguments.destination, strip_components=extract_arguments.strip_components, - progress=extract_arguments.progress, + progress=extract_arguments.progress or config.get('progress'), ) diff --git a/borgmatic/borg/check.py b/borgmatic/borg/check.py index 00a090a2..98c48946 100644 --- a/borgmatic/borg/check.py +++ b/borgmatic/borg/check.py @@ -143,6 +143,7 @@ def check_archives( umask = config.get('umask') borg_exit_codes = config.get('borg_exit_codes') working_directory = borgmatic.config.paths.get_working_directory(config) + progress = check_arguments.progress or config.get('progress') if 'data' in checks: checks.add('archives') @@ -170,7 +171,7 @@ def check_archives( + (('--log-json',) if global_arguments.log_json else ()) + (('--lock-wait', str(lock_wait)) if lock_wait else ()) + verbosity_flags - + (('--progress',) if check_arguments.progress else ()) + + (('--progress',) if progress else ()) + (tuple(extra_borg_options.split(' ')) if extra_borg_options else ()) + 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 # captured. And progress messes with the terminal directly. 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), working_directory=working_directory, diff --git a/borgmatic/borg/transfer.py b/borgmatic/borg/transfer.py index 3af998a6..32dc48b3 100644 --- a/borgmatic/borg/transfer.py +++ b/borgmatic/borg/transfer.py @@ -56,7 +56,7 @@ def transfer_archives( return execute_command( full_command, 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), working_directory=borgmatic.config.paths.get_working_directory(config), borg_local_path=local_path, diff --git a/borgmatic/commands/arguments.py b/borgmatic/commands/arguments.py index bf65c24b..19b933d8 100644 --- a/borgmatic/commands/arguments.py +++ b/borgmatic/commands/arguments.py @@ -305,6 +305,7 @@ DEFAULT_FALSE_FLAG_NAMES = { 'healthchecks.create_slug', 'repositories[0].append_only', 'repositories[0].make_parent_dirs', + 'progress', } diff --git a/borgmatic/config/schema.yaml b/borgmatic/config/schema.yaml index 04051ece..fbb2f5a4 100644 --- a/borgmatic/config/schema.yaml +++ b/borgmatic/config/schema.yaml @@ -793,6 +793,12 @@ properties: Apply color to console output. Can be overridden with --no-color command-line flag. Defaults to true. example: false + progress: + type: boolean + description: | + Display progress as each file or archive is processed. Defaults to + false. + example: true skip_actions: type: array items: