handle DryRun send size estimate errors with bookmarks

This commit is contained in:
Christian Schwarz
2018-09-05 17:41:25 -07:00
parent 9eca269ad8
commit acd2418803
6 changed files with 39 additions and 15 deletions
+16 -11
View File
@@ -235,23 +235,28 @@ func (t *tui) drawBar(name string, maxNameLength int, status string, bytes int64
t.write(rightPad(status, 14, " "))
t.write(" ")
length := 50
var completedLength int
if totalBytes > 0 {
length := 50
completedLength := int(int64(length) * bytes / totalBytes)
completedLength = int(int64(length) * bytes / totalBytes)
if completedLength > length {
completedLength = length
}
t.write("[")
t.write(times("=", completedLength))
t.write(">")
t.write(times("-", length-completedLength))
t.write("]")
t.write(" ")
t.write(rightPad(ByteCountBinary(bytes) + "/" + ByteCountBinary(totalBytes), 20, " "))
}
t.write("[")
t.write(times("=", completedLength))
t.write(">")
t.write(times("-", length-completedLength))
t.write("]")
t.write(" ")
totalBytesStr := ByteCountBinary(totalBytes)
if totalBytes == 0 {
totalBytesStr = "??? B"
}
t.write(rightPad(ByteCountBinary(bytes)+"/"+totalBytesStr, 20, " "))
t.newline()
}