A collection of highly customisable loading bars for Go CLI apps.
MIT License
A collection of highly customisable loading bars for Go CLI apps.
package main
import (
"github.com/liamg/loading/pkg/bar"
"time"
)
func main() {
// create a bar
loadingBar := bar.New()
// set the total to 100
loadingBar.SetTotal(100)
// increment the bar to 100 over 10 seconds
for i := 0; i <= 100; i++ {
time.Sleep(time.Millisecond * 100)
loadingBar.SetCurrent(i)
}
}
See the examples or the gallery below for more inspiration.
bar.OptionWithLabel("my label")
.bar.OptionWithRenderFunc(bar.RenderRainbow)
bar.OptionWithStatsFuncs(bar.StatsTimeRemaining)