mirror of
https://github.com/zrepl/zrepl.git
synced 2025-06-19 17:27:46 +02:00
nicer progress bar
This commit is contained in:
parent
98f3f3dfd8
commit
583773025f
@ -205,15 +205,18 @@ func rightPad(str string, length int, pad string) string {
|
|||||||
func (t *tui) drawBar(name string, status string, bytes int64, totalBytes int64) {
|
func (t *tui) drawBar(name string, status string, bytes int64, totalBytes int64) {
|
||||||
t.write(rightPad(name, 20, " "))
|
t.write(rightPad(name, 20, " "))
|
||||||
t.write(" ")
|
t.write(" ")
|
||||||
t.write(rightPad(status, 20, " "))
|
t.write(rightPad(status, 14, " "))
|
||||||
|
t.write(" ")
|
||||||
|
|
||||||
if totalBytes > 0 {
|
if totalBytes > 0 {
|
||||||
length := 50
|
length := 50
|
||||||
completedLength := int(int64(length) * bytes / totalBytes)
|
completedLength := int(int64(length) * bytes / totalBytes)
|
||||||
|
|
||||||
|
t.write("[")
|
||||||
t.write(times("=", completedLength))
|
t.write(times("=", completedLength))
|
||||||
t.write(">")
|
t.write(">")
|
||||||
t.write(times("-", length-completedLength))
|
t.write(times("-", length-completedLength))
|
||||||
|
t.write("]")
|
||||||
|
|
||||||
t.write(" ")
|
t.write(" ")
|
||||||
t.write(rightPad(ByteCountBinary(bytes) + "/" + ByteCountBinary(bytes), 16, " "))
|
t.write(rightPad(ByteCountBinary(bytes) + "/" + ByteCountBinary(bytes), 16, " "))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user