From ed6022d4a93b22921d1cb907e2d74e875bda1f18 Mon Sep 17 00:00:00 2001 From: Dan Helfman Date: Wed, 19 Mar 2025 23:05:38 -0700 Subject: [PATCH] Add "list" option to configuration, corresponding to "--list" (#303). --- borgmatic/actions/create.py | 2 +- borgmatic/actions/export_tar.py | 2 +- borgmatic/borg/delete.py | 2 +- borgmatic/borg/prune.py | 2 +- borgmatic/config/schema.yaml | 32 ++++++++++++++++++++++---------- 5 files changed, 26 insertions(+), 14 deletions(-) diff --git a/borgmatic/actions/create.py b/borgmatic/actions/create.py index 47e915e5..c771f3d2 100644 --- a/borgmatic/actions/create.py +++ b/borgmatic/actions/create.py @@ -330,7 +330,7 @@ def run_create( progress=create_arguments.progress or config.get('progress'), stats=create_arguments.stats or config.get('stats'), json=create_arguments.json, - list_files=create_arguments.list_files, + list_files=create_arguments.list_files or config.get('list'), stream_processes=stream_processes, ) diff --git a/borgmatic/actions/export_tar.py b/borgmatic/actions/export_tar.py index d5c6bacb..1b41548b 100644 --- a/borgmatic/actions/export_tar.py +++ b/borgmatic/actions/export_tar.py @@ -43,6 +43,6 @@ def run_export_tar( local_path=local_path, remote_path=remote_path, tar_filter=export_tar_arguments.tar_filter, - list_files=export_tar_arguments.list_files, + list_files=export_tar_arguments.list_files or config.get('list'), strip_components=export_tar_arguments.strip_components, ) diff --git a/borgmatic/borg/delete.py b/borgmatic/borg/delete.py index d967582c..d5b02335 100644 --- a/borgmatic/borg/delete.py +++ b/borgmatic/borg/delete.py @@ -34,7 +34,7 @@ def make_delete_command( + borgmatic.borg.flags.make_flags('umask', config.get('umask')) + borgmatic.borg.flags.make_flags('log-json', global_arguments.log_json) + borgmatic.borg.flags.make_flags('lock-wait', config.get('lock_wait')) - + borgmatic.borg.flags.make_flags('list', delete_arguments.list_archives) + + borgmatic.borg.flags.make_flags('list', delete_arguments.list_archives or config.get('list')) + ( (('--force',) + (('--force',) if delete_arguments.force >= 2 else ())) if delete_arguments.force diff --git a/borgmatic/borg/prune.py b/borgmatic/borg/prune.py index 38d0ed67..5eef3a29 100644 --- a/borgmatic/borg/prune.py +++ b/borgmatic/borg/prune.py @@ -88,7 +88,7 @@ def prune_archives( prune_arguments, excludes=('repository', 'match_archives', 'stats', 'list_archives'), ) - + (('--list',) if prune_arguments.list_archives else ()) + + (('--list',) if prune_arguments.list_archives or config.get('list') else ()) + (('--debug', '--show-rc') if logger.isEnabledFor(logging.DEBUG) else ()) + (('--dry-run',) if dry_run else ()) + (tuple(extra_borg_options.split(' ')) if extra_borg_options else ()) diff --git a/borgmatic/config/schema.yaml b/borgmatic/config/schema.yaml index ab0ae1a3..71161990 100644 --- a/borgmatic/config/schema.yaml +++ b/borgmatic/config/schema.yaml @@ -49,30 +49,33 @@ properties: type: string description: | The encryption mode with which to create the repository, - only used for the repo-create action. To see the - available encryption modes, run "borg init --help" with - Borg 1 or "borg repo-create --help" with Borg 2. + only used for the repo-create action. Also set via the + "--encryption" flag. To see the available encryption + modes, run "borg init --help" with Borg 1 or "borg + repo-create --help" with Borg 2. example: repokey-blake2 append_only: type: boolean description: | Whether the repository should be created append-only, - only used for the repo-create action. Defaults to false. + only used for the repo-create action. Also set via the + "--append-only" flag. Defaults to false. default: false example: true storage_quota: type: string description: | The storage quota with which to create the repository, - only used for the repo-create action. Defaults to no - quota. + only used for the repo-create action. Also set via the + "--storage-quota" flag. Defaults to no quota. example: 5G make_parent_dirs: type: boolean description: | Whether any missing parent directories of the repository path should be created, only used for the repo-create - action. Defaults to false. + action. Also set via the "--make-parent-dirs" flag. + Defaults to false. default: false example: true description: | @@ -812,15 +815,24 @@ properties: progress: type: boolean description: | - Display progress as each file or archive is processed. Defaults to + Display progress as each file or archive is processed when running + supported actions. Also set via the "--progress" flag. Defaults to false. default: false example: true stats: type: boolean description: | - Display statistics of an archive when running supported actions. - Defaults to false. + Display statistics for an archive when running supported actions. + Also set via the "--stats" flag. Defaults to false. + default: false + example: true + list: + type: boolean + description: | + Display details for each file or archive as it is processed when + running supported actions. Also set via the "--list" flag. Defaults + to false. default: false example: true skip_actions: