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, local_path,
remote_path, remote_path,
), ),
mount_arguments.mount_point,
mount_arguments.paths,
mount_arguments.foreground,
mount_arguments.options,
mount_arguments, mount_arguments,
storage, storage,
local_borg_version, local_borg_version,

View File

@ -47,8 +47,6 @@ def run_prune(
prune_arguments, prune_arguments,
local_path=local_path, local_path=local_path,
remote_path=remote_path, remote_path=remote_path,
stats=prune_arguments.stats,
list_archives=prune_arguments.list_archives,
) )
borgmatic.hooks.command.execute_hook( borgmatic.hooks.command.execute_hook(
hooks.get('after_prune'), hooks.get('after_prune'),

View File

@ -46,8 +46,6 @@ def prune_archives(
prune_arguments, prune_arguments,
local_path='borg', local_path='borg',
remote_path=None, remote_path=None,
stats=False,
list_archives=False,
): ):
''' '''
Given dry-run flag, a local or remote repository path, a storage config dict, and a 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 ()) + (('--remote-path', remote_path) if remote_path else ())
+ (('--umask', str(umask)) if umask else ()) + (('--umask', str(umask)) if umask else ())
+ (('--lock-wait', str(lock_wait)) if lock_wait 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 ()) + (('--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_from_arguments(
+ (flags.make_flags('oldest', prune_arguments.oldest) if prune_arguments.oldest else ()) prune_arguments,
+ (flags.make_flags('older', prune_arguments.older) if prune_arguments.older else ()) excludes=('repository', 'stats'),
+ (flags.make_flags('newer', prune_arguments.newer) if prune_arguments.newer else ()) )
+ (('--debug', '--show-rc') if logger.isEnabledFor(logging.DEBUG) 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 ()) + (tuple(extra_borg_options.split(' ')) if extra_borg_options else ())
+ flags.make_repository_flags(repository, local_borg_version) + 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 output_log_level = logging.ANSWER
else: else:
output_log_level = logging.INFO output_log_level = logging.INFO