https://github.com/slimtoolkit/uilive
uilive is a go library for updating terminal output in realtime
https://github.com/slimtoolkit/uilive
Last synced: 6 months ago
JSON representation
uilive is a go library for updating terminal output in realtime
- Host: GitHub
- URL: https://github.com/slimtoolkit/uilive
- Owner: slimtoolkit
- License: mit
- Fork: true (gosuri/uilive)
- Created: 2019-05-05T18:00:10.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-05-05T19:31:23.000Z (about 7 years ago)
- Last Synced: 2024-06-19T19:46:31.307Z (about 2 years ago)
- Language: Go
- Homepage:
- Size: 316 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# uilive [](https://godoc.org/github.com/docker-slim/uilive) [](https://travis-ci.org/docker-slim/uilive)
## Note
Fixing the os.Exit problem and a few other things...
## Original Package Info
uilive is a go library for updating terminal output in realtime. It provides a buffered [io.Writer](https://golang.org/pkg/io/#Writer) that is flushed at a timed interval. uilive powers [uiprogress](https://github.com/docker-slim/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](example/main.go).
```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

### Installation
```sh
$ go get -v github.com/docker-slim/uilive
```