removed individual action parameters, and used make_flags_from_arguments

Signed-off-by: Chirag Aggarwal <thechiragaggarwal@gmail.com>
This commit is contained in:
Chirag Aggarwal 2023-03-28 18:10:42 +05:30
parent 4fa4fccab7
commit edd79ed86c
3 changed files with 9 additions and 16 deletions

View file

@ -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,

View file

@ -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'),

View file

@ -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