Browse Source

implement --list for borg extract

before, borg extract always emitted the full file list at info log level.
now, you need to give --list to get the full file list (consistent with borg create --list).

this is currently only useful if you also use other output-generating options,
e.g. --show-rc - you can now leave away --list to only get that other output.

later, if extract gets more output-generating options, --list will get more useful.
Thomas Waldmann 9 years ago
parent
commit
e7c2189a3f
1 changed files with 6 additions and 1 deletions
  1. 6 1
      borg/archiver.py

+ 6 - 1
borg/archiver.py

@@ -318,6 +318,7 @@ class Archiver:
 
         matcher.fallback = not include_patterns
 
+        output_list = args.output_list
         dry_run = args.dry_run
         stdout = args.stdout
         sparse = args.sparse
@@ -332,7 +333,8 @@ class Archiver:
             if not args.dry_run:
                 while dirs and not item[b'path'].startswith(dirs[-1][b'path']):
                     archive.extract_item(dirs.pop(-1), stdout=stdout)
-            logger.info(remove_surrogates(orig_path))
+            if output_list:
+                logger.info(remove_surrogates(orig_path))
             try:
                 if dry_run:
                     archive.extract_item(item, dry_run=True)
@@ -1006,6 +1008,9 @@ class Archiver:
                                           formatter_class=argparse.RawDescriptionHelpFormatter,
                                           help='extract archive contents')
         subparser.set_defaults(func=self.do_extract)
+        subparser.add_argument('--list', dest='output_list',
+                               action='store_true', default=False,
+                               help='output verbose list of items (files, dirs, ...)')
         subparser.add_argument('-n', '--dry-run', dest='dry_run',
                                default=False, action='store_true',
                                help='do not actually change any files')