simplify processing for borg list --short

just use the respective format string.
This commit is contained in:
Thomas Waldmann 2016-02-21 21:35:00 +01:00
parent d14e6f720c
commit dc5467e9bc
1 changed files with 64 additions and 64 deletions

View File

@ -438,17 +438,17 @@ class Archiver:
manifest, key = Manifest.load(repository)
if args.location.archive:
archive = Archive(repository, key, manifest, args.location.archive)
if args.short:
for item in archive.iter_items():
print(remove_surrogates(item[b'path']))
else:
"""use_user_format flag is used to speed up default listing.
When user issues format options, listing is a bit slower, but more keys are available and
precalculated.
"""
use_user_format = args.listformat is not None
list_format = args.listformat if use_user_format else \
"{mode} {user:6} {group:6} {size:8d} {isomtime} {path}{extra}{LF}"
if use_user_format:
list_format = args.listformat
elif args.short:
list_format = "{path}{LF}"
else:
list_format = "{mode} {user:6} {group:6} {size:8d} {isomtime} {path}{extra}{LF}"
for item in archive.iter_items():
mode = stat.filemode(item[b'mode'])