1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2024-12-26 01:37:20 +00:00

Merge pull request #848 from Ape/pr/escape_cmdline

Escape cmdline arguments that have spaces in them
This commit is contained in:
TW 2016-04-06 15:17:36 +02:00
commit 9d13a10653

View file

@ -725,6 +725,9 @@ def write(bytestring):
@with_archive @with_archive
def do_info(self, args, repository, manifest, key, archive, cache): def do_info(self, args, repository, manifest, key, archive, cache):
"""Show archive details such as disk space used""" """Show archive details such as disk space used"""
def format_cmdline(cmdline):
return remove_surrogates(' '.join(shlex.quote(x) for x in cmdline))
stats = archive.calc_stats(cache) stats = archive.calc_stats(cache)
print('Name:', archive.name) print('Name:', archive.name)
print('Fingerprint: %s' % hexlify(archive.id).decode('ascii')) print('Fingerprint: %s' % hexlify(archive.id).decode('ascii'))
@ -732,7 +735,7 @@ def do_info(self, args, repository, manifest, key, archive, cache):
print('Username:', archive.metadata[b'username']) print('Username:', archive.metadata[b'username'])
print('Time (start): %s' % format_time(to_localtime(archive.ts))) print('Time (start): %s' % format_time(to_localtime(archive.ts)))
print('Time (end): %s' % format_time(to_localtime(archive.ts_end))) print('Time (end): %s' % format_time(to_localtime(archive.ts_end)))
print('Command line:', remove_surrogates(' '.join(archive.metadata[b'cmdline']))) print('Command line:', format_cmdline(archive.metadata[b'cmdline']))
print('Number of files: %d' % stats.nfiles) print('Number of files: %d' % stats.nfiles)
print() print()
print(str(stats)) print(str(stats))