kevinschoon-pomo/vendor/github.com/gosuri/uilive
Kevin Schoon 499d829860 add vendor 2018-01-21 18:41:29 +08:00
..
doc add vendor 2018-01-21 18:41:29 +08:00
example add vendor 2018-01-21 18:41:29 +08:00
.travis.yml add vendor 2018-01-21 18:41:29 +08:00
LICENSE add vendor 2018-01-21 18:41:29 +08:00
README.md add vendor 2018-01-21 18:41:29 +08:00
doc.go add vendor 2018-01-21 18:41:29 +08:00
example_test.go add vendor 2018-01-21 18:41:29 +08:00
writer.go add vendor 2018-01-21 18:41:29 +08:00
writer_posix.go add vendor 2018-01-21 18:41:29 +08:00
writer_test.go add vendor 2018-01-21 18:41:29 +08:00
writer_windows.go add vendor 2018-01-21 18:41:29 +08:00

README.md

uilive GoDoc Build Status

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

Usage Example

Calling uilive.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 := uilive.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 github.com/gosuri/uilive