2
0
Эх сурвалжийг харах

Support for Borg create --progress via borgmatic command-line flag (#108).

Dan Helfman 6 жил өмнө
parent
commit
9ca80a54d8

+ 3 - 0
NEWS

@@ -1,3 +1,6 @@
+1.2.11
+ * #108: Support for Borg create --progress via borgmatic command-line flag.
+
 1.2.10
  * #105: Support for Borg --chunker-params create option via "chunker_params" in borgmatic's storage
    section.

+ 2 - 0
borgmatic/borg/create.py

@@ -104,6 +104,7 @@ def create_archive(
     storage_config,
     local_path='borg',
     remote_path=None,
+    progress=False,
     json=False,
 ):
     '''
@@ -151,6 +152,7 @@ def create_archive(
         + (('--stats',) if not dry_run and logger.isEnabledFor(logging.INFO) else ())
         + (('--debug', '--show-rc') if logger.isEnabledFor(logging.DEBUG) else ())
         + (('--dry-run',) if dry_run else ())
+        + (('--progress',) if progress else ())
         + (('--json',) if json else ())
     )
 

+ 11 - 0
borgmatic/commands/borgmatic.py

@@ -78,6 +78,13 @@ def parse_arguments(*arguments):
         action='store_true',
         help='Display summary information on archives',
     )
+    parser.add_argument(
+        '--progress',
+        dest='progress',
+        default=False,
+        action='store_true',
+        help='Display progress with --create option for each file as it is backed up',
+    )
     parser.add_argument(
         '--json',
         dest='json',
@@ -103,6 +110,9 @@ def parse_arguments(*arguments):
 
     args = parser.parse_args(arguments)
 
+    if args.progress and not args.create:
+        raise ValueError('The --progress option can only be used with the --create option')
+
     if args.json and not (args.create or args.list or args.info):
         raise ValueError(
             'The --json option can only be used with the --create, --list, or --info options'
@@ -212,6 +222,7 @@ def _run_commands_on_repository(
             storage,
             local_path=local_path,
             remote_path=remote_path,
+            progress=args.progress,
         )
     if args.check and checks.repository_enabled_for_checks(repository, consistency):
         logger.info('{}: Running consistency checks'.format(repository))

+ 1 - 0
scripts/find-unsupported-borg-options

@@ -40,6 +40,7 @@ for sub_command in prune create check list info; do
             | grep -v '^--list$' \
             | grep -v '^--nobsdflags$' \
             | grep -v '^--pattern$' \
+            | grep -v '^--progress$' \
             | grep -v '^--read-special$' \
             | grep -v '^--repository-only$' \
             | grep -v '^--show-rc$' \

+ 1 - 1
setup.py

@@ -1,7 +1,7 @@
 from setuptools import setup, find_packages
 
 
-VERSION = '1.2.10'
+VERSION = '1.2.11'
 
 
 setup(