mirror of
https://github.com/borgbackup/borg.git
synced 2025-02-07 06:59:38 +00:00
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.
This commit is contained in:
parent
74ac982775
commit
e7c2189a3f
1 changed files with 6 additions and 1 deletions
|
@ -318,6 +318,7 @@ def do_extract(self, args):
|
|||
|
||||
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 @@ def do_extract(self, args):
|
|||
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 @@ def build_parser(self, args=None, prog=None):
|
|||
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')
|
||||
|
|
Loading…
Reference in a new issue