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
Cancel
Notice: Creating folder will generate an empty file .keep, because not support in Git
Loading...
README.md

uiprogress

uiprogress is a go library for updating terminal output in realtime. It provides a buffered io.Writer that is flushed at a timed interval. uiprogress powers uiprogress.

Usage Example

Calling uiprogress.New() will create a new writer. To start rendering, simply call writer.Start() and update the ui by writing to the writer. Full source for the below example is in example/main.go.

writer := uiprogress.New()
// start listening for updates and render
writer.Start()

for i := 0; i <= 100; i++ {
  fmt.Fprintf(writer, "Downloading.. (%d/%d) GB\n", i, 100)
  time.Sleep(time.Millisecond * 5)
}

fmt.Fprintln(writer, "Finished: Downloaded 100GB")
writer.Stop() // flush and stop rendering

The above will render

example

Installation

$ go get -v gitee.com/shirdonl/uiprogress
Go
1
https://gitee.com/shirdonl/uiprogress.git
git@gitee.com:shirdonl/uiprogress.git
shirdonl
uiprogress
uiprogress
master

Help Search