-
Notifications
You must be signed in to change notification settings - Fork 88
Closed
Description
When the RefreshInterval is too little like time.Nanosecond little or 0, you should use writer.Wait() to be able to use the library, but still the text glitches a little. And when you do not use the writer.Wait(), the library isn't able to replace the text and start to act almost like a regular fmt.Println.
package main
import (
"fmt"
"github.com/gosuri/uilive"
)
func main() {
writer := uilive.New()
// start listening for updates and render
writer.RefreshInterval = 0
writer.Start()
for _, f := range []string{"Foo.zip", "Bar.iso"} {
for i := 0; i <= 5000000; i++ {
fmt.Fprintf(writer, "Downloading %s.. (%d/%d) GB\n", f, i, 50)
writer.Wait()
}
fmt.Fprintf(writer.Bypass(), "Downloaded %s\n", f)
}
fmt.Fprintln(writer, "Finished: Downloaded 100GB")
writer.Stop() // flush and stop rendering
}Metadata
Metadata
Assignees
Labels
No labels