|
@@ -6,7 +6,7 @@ from subprocess import CalledProcessError
|
|
import sys
|
|
import sys
|
|
|
|
|
|
from borgmatic.borg import check as borg_check, create as borg_create, prune as borg_prune, \
|
|
from borgmatic.borg import check as borg_check, create as borg_create, prune as borg_prune, \
|
|
- list as borg_list
|
|
|
|
|
|
+ list as borg_list, info as borg_info
|
|
from borgmatic.commands import hook
|
|
from borgmatic.commands import hook
|
|
from borgmatic.config import collect, convert, validate
|
|
from borgmatic.config import collect, convert, validate
|
|
from borgmatic.signals import configure_signals
|
|
from borgmatic.signals import configure_signals
|
|
@@ -68,6 +68,12 @@ def parse_arguments(*arguments):
|
|
action='store_true',
|
|
action='store_true',
|
|
help='List archives',
|
|
help='List archives',
|
|
)
|
|
)
|
|
|
|
+ parser.add_argument(
|
|
|
|
+ '-i', '--info',
|
|
|
|
+ dest='info',
|
|
|
|
+ action='store_true',
|
|
|
|
+ help='Display summary information on archives',
|
|
|
|
+ )
|
|
parser.add_argument(
|
|
parser.add_argument(
|
|
'-n', '--dry-run',
|
|
'-n', '--dry-run',
|
|
dest='dry_run',
|
|
dest='dry_run',
|
|
@@ -84,11 +90,12 @@ def parse_arguments(*arguments):
|
|
|
|
|
|
# If any of the action flags are explicitly requested, leave them as-is. Otherwise, assume
|
|
# If any of the action flags are explicitly requested, leave them as-is. Otherwise, assume
|
|
# defaults: Mutate the given arguments to enable the default actions.
|
|
# defaults: Mutate the given arguments to enable the default actions.
|
|
- if not args.prune and not args.create and not args.check and not args.list:
|
|
|
|
- args.prune = True
|
|
|
|
- args.create = True
|
|
|
|
- args.check = True
|
|
|
|
|
|
+ if args.prune or args.create or args.check or args.list or args.info:
|
|
|
|
+ return args
|
|
|
|
|
|
|
|
+ args.prune = True
|
|
|
|
+ args.create = True
|
|
|
|
+ args.check = True
|
|
return args
|
|
return args
|
|
|
|
|
|
|
|
|
|
@@ -154,6 +161,15 @@ def run_configuration(config_filename, args): # pragma: no cover
|
|
local_path=local_path,
|
|
local_path=local_path,
|
|
remote_path=remote_path,
|
|
remote_path=remote_path,
|
|
)
|
|
)
|
|
|
|
+ if args.info:
|
|
|
|
+ logger.info('{}: Displaying summary info for archives'.format(repository))
|
|
|
|
+ borg_info.display_archives_info(
|
|
|
|
+ args.verbosity,
|
|
|
|
+ repository,
|
|
|
|
+ storage,
|
|
|
|
+ local_path=local_path,
|
|
|
|
+ remote_path=remote_path,
|
|
|
|
+ )
|
|
|
|
|
|
hook.execute_hook(hooks.get('after_backup'), config_filename, 'post-backup')
|
|
hook.execute_hook(hooks.get('after_backup'), config_filename, 'post-backup')
|
|
except (OSError, CalledProcessError):
|
|
except (OSError, CalledProcessError):
|