mirror of
https://github.com/borgbackup/borg.git
synced 2024-12-26 09:47:58 +00:00
Merge pull request #977 from ThomasWaldmann/info-show-duration
make borg info more similar to borg create --stats, add duration
This commit is contained in:
commit
ddc7687d9e
2 changed files with 12 additions and 7 deletions
|
@ -199,6 +199,10 @@ def fpr(self):
|
||||||
def duration(self):
|
def duration(self):
|
||||||
return format_timedelta(self.end - self.start)
|
return format_timedelta(self.end - self.start)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def duration_from_meta(self):
|
||||||
|
return format_timedelta(self.ts_end - self.ts)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return '''\
|
return '''\
|
||||||
Archive name: {0.name}
|
Archive name: {0.name}
|
||||||
|
|
|
@ -758,16 +758,17 @@ def format_cmdline(cmdline):
|
||||||
return remove_surrogates(' '.join(shlex.quote(x) for x in 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('Archive name: %s' % archive.name)
|
||||||
print('Fingerprint: %s' % archive.fpr)
|
print('Archive fingerprint: %s' % archive.fpr)
|
||||||
print('Comment:', archive.metadata.get(b'comment', ''))
|
print('Comment: %s' % archive.metadata.get(b'comment', ''))
|
||||||
print('Hostname:', archive.metadata[b'hostname'])
|
print('Hostname: %s' % archive.metadata[b'hostname'])
|
||||||
print('Username:', archive.metadata[b'username'])
|
print('Username: %s' % 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:', format_cmdline(archive.metadata[b'cmdline']))
|
print('Duration: %s' % archive.duration_from_meta)
|
||||||
print('Number of files: %d' % stats.nfiles)
|
print('Number of files: %d' % stats.nfiles)
|
||||||
print()
|
print('Command line: %s' % format_cmdline(archive.metadata[b'cmdline']))
|
||||||
|
print(DASHES)
|
||||||
print(str(stats))
|
print(str(stats))
|
||||||
print(str(cache))
|
print(str(cache))
|
||||||
return self.exit_code
|
return self.exit_code
|
||||||
|
|
Loading…
Reference in a new issue