mirror of https://github.com/borgbackup/borg.git
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
|
@ -199,6 +199,10 @@ class Archive:
|
|||
def duration(self):
|
||||
return format_timedelta(self.end - self.start)
|
||||
|
||||
@property
|
||||
def duration_from_meta(self):
|
||||
return format_timedelta(self.ts_end - self.ts)
|
||||
|
||||
def __str__(self):
|
||||
return '''\
|
||||
Archive name: {0.name}
|
||||
|
|
|
@ -758,16 +758,17 @@ class Archiver:
|
|||
return remove_surrogates(' '.join(shlex.quote(x) for x in cmdline))
|
||||
|
||||
stats = archive.calc_stats(cache)
|
||||
print('Name:', archive.name)
|
||||
print('Fingerprint: %s' % archive.fpr)
|
||||
print('Comment:', archive.metadata.get(b'comment', ''))
|
||||
print('Hostname:', archive.metadata[b'hostname'])
|
||||
print('Username:', archive.metadata[b'username'])
|
||||
print('Archive name: %s' % archive.name)
|
||||
print('Archive fingerprint: %s' % archive.fpr)
|
||||
print('Comment: %s' % archive.metadata.get(b'comment', ''))
|
||||
print('Hostname: %s' % archive.metadata[b'hostname'])
|
||||
print('Username: %s' % archive.metadata[b'username'])
|
||||
print('Time (start): %s' % format_time(to_localtime(archive.ts)))
|
||||
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()
|
||||
print('Command line: %s' % format_cmdline(archive.metadata[b'cmdline']))
|
||||
print(DASHES)
|
||||
print(str(stats))
|
||||
print(str(cache))
|
||||
return self.exit_code
|
||||
|
|
Loading…
Reference in New Issue