uilive is a go library for updating terminal output in realtime
Go
1,722
25 commits
updated Jul 22, 2023
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.
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

$ go get -v github.com/gosuri/uilive
Overall
Maintained
Code review
Go module
Latest release
Releases this year
(top 24 of 30)
54,603 followers · starred Sep 2019
8,914 followers · starred May 2019
1,436 followers · starred Nov 2021
392 followers · starred Feb 2024
uilive is a go library for updating terminal output in realtime
Go
1,722
25 commits
updated Jul 22, 2023
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.
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

$ go get -v github.com/gosuri/uilive
Overall
Maintained
Code review
Go module
Latest release
Releases this year
(top 24 of 30)
54,603 followers · starred Sep 2019
8,914 followers · starred May 2019
1,436 followers · starred Nov 2021
392 followers · starred Feb 2024