Skip to content
forked from gosuri/uilive

uilive is a go library for updating terminal output in realtime

License

Notifications You must be signed in to change notification settings

Adaendra/uilive

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

60 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

UILive

GoDoc Go Version

This project is a fork of gosuri/uilive which hasn't been updated for years.

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

Installation

$ go get -v github.com/Adaendra/uilive

How to use it ?

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/single_line/single_line.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

All examples

About

uilive is a go library for updating terminal output in realtime

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 99.1%
  • Makefile 0.9%