From edd79ed86cca097216741363151deebe35839e25 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Tue, 28 Mar 2023 18:10:42 +0530 Subject: [PATCH] removed individual action parameters, and used make_flags_from_arguments Signed-off-by: Chirag Aggarwal --- borgmatic/actions/mount.py | 4 ---- borgmatic/actions/prune.py | 2 -- borgmatic/borg/prune.py | 19 +++++++++---------- 3 files changed, 9 insertions(+), 16 deletions(-) diff --git a/borgmatic/actions/mount.py b/borgmatic/actions/mount.py index 2b661ec..b1a1132 100644 --- a/borgmatic/actions/mount.py +++ b/borgmatic/actions/mount.py @@ -31,10 +31,6 @@ def run_mount( local_path, remote_path, ), - mount_arguments.mount_point, - mount_arguments.paths, - mount_arguments.foreground, - mount_arguments.options, mount_arguments, storage, local_borg_version, diff --git a/borgmatic/actions/prune.py b/borgmatic/actions/prune.py index a89b717..09666ee 100644 --- a/borgmatic/actions/prune.py +++ b/borgmatic/actions/prune.py @@ -47,8 +47,6 @@ def run_prune( prune_arguments, local_path=local_path, remote_path=remote_path, - stats=prune_arguments.stats, - list_archives=prune_arguments.list_archives, ) borgmatic.hooks.command.execute_hook( hooks.get('after_prune'), diff --git a/borgmatic/borg/prune.py b/borgmatic/borg/prune.py index aa81a7f..b8b1d6b 100644 --- a/borgmatic/borg/prune.py +++ b/borgmatic/borg/prune.py @@ -46,8 +46,6 @@ def prune_archives( prune_arguments, local_path='borg', remote_path=None, - stats=False, - list_archives=False, ): ''' Given dry-run flag, a local or remote repository path, a storage config dict, and a @@ -69,20 +67,21 @@ def prune_archives( + (('--remote-path', remote_path) if remote_path else ()) + (('--umask', str(umask)) if umask else ()) + (('--lock-wait', str(lock_wait)) if lock_wait else ()) - + (('--stats',) if stats and not dry_run else ()) + + (('--stats',) if prune_arguments.stats and not dry_run else ()) + (('--info',) if logger.getEffectiveLevel() == logging.INFO else ()) - + (('--list',) if list_archives else ()) - + (flags.make_flags('newest', prune_arguments.newest) if prune_arguments.newest else ()) - + (flags.make_flags('oldest', prune_arguments.oldest) if prune_arguments.oldest else ()) - + (flags.make_flags('older', prune_arguments.older) if prune_arguments.older else ()) - + (flags.make_flags('newer', prune_arguments.newer) if prune_arguments.newer else ()) + + + flags.make_flags_from_arguments( + prune_arguments, + excludes=('repository', 'stats'), + ) + + (('--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 ()) + flags.make_repository_flags(repository, local_borg_version) ) - if stats or list_archives: + if prune_arguments.stats or prune_arguments.list_archives: output_log_level = logging.ANSWER else: output_log_level = logging.INFO