Watch 6 Star 6 Fork 2

ShirDon-廖显东 / uiprogressGoMIT

Join us
Explore and code with more than 2 million developers,Free private repositories !:)
Sign up
uiprogress是用于实时更新终端输出的go库 spread retract

https://gitee.com/shirdonl/uiprogress.git

Clone or download
main.go 726 Bytes
Copy Edit Web IDE Raw Blame History
ShirDon-廖显东 authored 2019-12-01 20:12 . git commit
package main
import (
"fmt"
"time"
"gitee.com/shirdonl/uiprogress"
)
func main() {
writer := uiprogress.New()
// start listening for updates and render
writer.Start()
for _, f := range [][]string{{"Foo.zip", "Bar.iso"}, {"Baz.tar.gz", "Qux.img"}} {
for i := 0; i <= 50; i++ {
_, _ = fmt.Fprintf(writer, "Downloading %s.. (%d/%d) GB\n", f[0], i, 50)
_, _ = fmt.Fprintf(writer.Newline(), "Downloading %s.. (%d/%d) GB\n", f[1], i, 50)
time.Sleep(time.Millisecond * 25)
}
_, _ = fmt.Fprintf(writer.Bypass(), "Downloaded %s\n", f[0])
_, _ = fmt.Fprintf(writer.Bypass(), "Downloaded %s\n", f[1])
}
_, _ = fmt.Fprintln(writer, "Finished: Downloaded 150GB")
writer.Stop() // flush and stop rendering
}
Go
1
https://gitee.com/shirdonl/uiprogress.git
git@gitee.com:shirdonl/uiprogress.git
shirdonl
uiprogress
uiprogress
master

Help Search