diff options
Diffstat (limited to 'internal/progress/new.go')
| -rw-r--r-- | internal/progress/new.go | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/internal/progress/new.go b/internal/progress/new.go new file mode 100644 index 00000000..a86a0660 --- /dev/null +++ b/internal/progress/new.go @@ -0,0 +1,22 @@ +package progress + +import "time" + +// New creates one progress meter. +func New(opts Options) *Meter { + now := time.Now() + + return &Meter{ + writer: opts.Writer, + flush: opts.Flush, + 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, + } +} |
