mirror of https://github.com/borgbackup/borg.git
Merge pull request #1489 from enkore/issue/1486
Fix borg-list --list-format
This commit is contained in:
commit
f7c1c71ff1
|
@ -793,7 +793,7 @@ class Archiver:
|
||||||
archive = Archive(repository, key, manifest, args.location.archive, cache=cache,
|
archive = Archive(repository, key, manifest, args.location.archive, cache=cache,
|
||||||
consider_part_files=args.consider_part_files)
|
consider_part_files=args.consider_part_files)
|
||||||
|
|
||||||
if args.format:
|
if args.format is not None:
|
||||||
format = args.format
|
format = args.format
|
||||||
elif args.short:
|
elif args.short:
|
||||||
format = "{path}{NL}"
|
format = "{path}{NL}"
|
||||||
|
@ -804,7 +804,7 @@ class Archiver:
|
||||||
for item in archive.iter_items(lambda item: matcher.match(item.path)):
|
for item in archive.iter_items(lambda item: matcher.match(item.path)):
|
||||||
write(safe_encode(formatter.format_item(item)))
|
write(safe_encode(formatter.format_item(item)))
|
||||||
else:
|
else:
|
||||||
if args.format:
|
if args.format is not None:
|
||||||
format = args.format
|
format = args.format
|
||||||
elif args.short:
|
elif args.short:
|
||||||
format = "{archive}{NL}"
|
format = "{archive}{NL}"
|
||||||
|
@ -1251,7 +1251,7 @@ class Archiver:
|
||||||
for old_name, new_name, warning in deprecations:
|
for old_name, new_name, warning in deprecations:
|
||||||
if arg.startswith(old_name):
|
if arg.startswith(old_name):
|
||||||
args[i] = arg.replace(old_name, new_name)
|
args[i] = arg.replace(old_name, new_name)
|
||||||
self.print_warning(warning)
|
print(warning, file=sys.stderr)
|
||||||
return args
|
return args
|
||||||
|
|
||||||
def build_parser(self, prog=None):
|
def build_parser(self, prog=None):
|
||||||
|
|
|
@ -1203,7 +1203,7 @@ class ArchiverTestCase(ArchiverTestCaseBase):
|
||||||
self.cmd('init', self.repository_location)
|
self.cmd('init', self.repository_location)
|
||||||
test_archive = self.repository_location + '::test'
|
test_archive = self.repository_location + '::test'
|
||||||
self.cmd('create', test_archive, src_dir)
|
self.cmd('create', test_archive, src_dir)
|
||||||
self.cmd('list', '--list-format', '-', test_archive, exit_code=1)
|
self.cmd('list', '--list-format', '-', test_archive)
|
||||||
self.archiver.exit_code = 0 # reset exit code for following tests
|
self.archiver.exit_code = 0 # reset exit code for following tests
|
||||||
output_1 = self.cmd('list', test_archive)
|
output_1 = self.cmd('list', test_archive)
|
||||||
output_2 = self.cmd('list', '--format', '{mode} {user:6} {group:6} {size:8d} {isomtime} {path}{extra}{NEWLINE}', test_archive)
|
output_2 = self.cmd('list', '--format', '{mode} {user:6} {group:6} {size:8d} {isomtime} {path}{extra}{NEWLINE}', test_archive)
|
||||||
|
|
Loading…
Reference in New Issue