ref: 3ce59c3248dec0eb0f918c42f37f53bc2ac20425
dir: /internal/progress/new.go/
package progress
import "time"
// New creates one progress meter.
func New(opts Options) *Meter {
now := time.Now()
return &Meter{
writer: opts.Writer,
title: opts.Title,
total: opts.Total,
delay: max(opts.Delay, time.Duration(0)),
sparse: opts.Sparse,
throughput: opts.Throughput,
startedAt: now,
nextUpdateAt: now.Add(updateInterval),
nextThroughput: now.Add(throughputInterval),
lastPercent: -1,
}
}