tdl/pkg/progress/progress.go
2022-09-04 10:55:15 +08:00

21 lines
490 B
Go

package progress
import (
"github.com/jedib0t/go-pretty/v6/progress"
"time"
)
func New() progress.Writer {
pw := progress.NewWriter()
pw.SetAutoStop(true)
pw.SetTrackerLength(25)
pw.SetMessageWidth(24)
pw.SetSortBy(progress.SortByPercentDsc)
pw.SetStyle(progress.StyleDefault)
pw.SetTrackerPosition(progress.PositionRight)
pw.SetUpdateFrequency(time.Millisecond * 100)
pw.Style().Colors = progress.StyleColorsExample
pw.Style().Options.PercentFormat = "%4.1f%%"
return pw
}