From 4c25495d68516ac1d98abdb828c298dcad9619b2 Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Sun, 6 May 2018 20:20:10 +0200 Subject: [PATCH] backup: Hide percent until total size is known --- internal/ui/backup.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/internal/ui/backup.go b/internal/ui/backup.go index 9a7d03a17..7dbe235c9 100644 --- a/internal/ui/backup.go +++ b/internal/ui/backup.go @@ -150,16 +150,18 @@ func (b *Backup) update(total, processed counter, errors uint, currentFiles map[ processed.Files, formatBytes(processed.Bytes), errors, ) } else { - var eta string + var eta, percent string if secs > 0 && processed.Bytes < total.Bytes { eta = fmt.Sprintf(" ETA %s", formatSeconds(secs)) + percent = formatPercent(processed.Bytes, total.Bytes) + percent += " " } // include totals - status = fmt.Sprintf("[%s] %s %v files %s, total %v files %v, %d errors%s", + status = fmt.Sprintf("[%s] %s%v files %s, total %v files %v, %d errors%s", formatDuration(time.Since(b.start)), - formatPercent(processed.Bytes, total.Bytes), + percent, processed.Files, formatBytes(processed.Bytes), total.Files,