summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2015-10-17 23:17:08 +0300
committerLars Wirzenius <liw@liw.fi>2015-10-17 23:17:08 +0300
commit570bdf1c10627605080b4ea71c7a89f36607dab6 (patch)
tree7605c22a58fdf7030ab694e8a14c61fd51cd989b
parentee5a89c44feb098cc3c75d7310b9af3a55173f29 (diff)
downloadgenbackupdata-570bdf1c10627605080b4ea71c7a89f36607dab6.tar.gz
Embellish progress reporting for new ttystatus
-rwxr-xr-xgenbackupdata19
1 files changed, 14 insertions, 5 deletions
diff --git a/genbackupdata b/genbackupdata
index ccbe992..e2394fa 100755
--- a/genbackupdata
+++ b/genbackupdata
@@ -59,7 +59,7 @@ class GenbackupdataApp(cliapp.Application):
self.names = genbackupdatalib.NameGenerator(
outputdir, self.settings['depth'], self.settings['max-files'])
- self.setup_ttystatus()
+ self.setup_ttystatus(outputdir)
self.status['total'] = bytes
while bytes > 0:
n = min(self.settings['file-size'], bytes)
@@ -89,15 +89,24 @@ class GenbackupdataApp(cliapp.Application):
f.write(chunk)
self.status['written'] += bytes
- def setup_ttystatus(self):
+ def setup_ttystatus(self, outputdir):
self.status = ttystatus.TerminalStatus(period=0.1)
if self.settings['quiet']:
self.status.disable()
+ if hasattr(self.status, 'start_new_line'):
+ self.status.format(
+ 'Generating backup data: %Pathname(outputdir)\n'
+ '%ByteSize(written) of %ByteSize(total) '
+ '%PercentDone(written,total) (%ByteSpeed(written))\n'
+ '%RemainingTime(written,total) %ProgressBar(written,total)')
+ else:
+ self.status.format(
+ 'Generating %ByteSize(written) of %ByteSize(total) '
+ '%PercentDone(written,total) (%ByteSpeed(written))')
+
self.status['written'] = 0
self.status['total'] = 0
- self.status.format(
- 'Generating %ByteSize(written) of %ByteSize(total) '
- '%PercentDone(written,total) (%ByteSpeed(written))')
+ self.status['outputdir'] = outputdir
if __name__ == '__main__':