progress: extract progress updating into Updater struct

This allows reusing the code to create periodic progress updates.
This commit is contained in:
Michael Eischer committed 2023-01-14 01:13:08 +01:00
1 parent 52682b1c7b
commit e499bbe3ae
6 files changed
+152 -83

No files matched your search

+1 -1
View File
@@ -37,7 +37,7 @@ func newProgressMax(show bool, max uint64, description string) *progress.Counter
interval := calculateProgressInterval(show, false)
canUpdateStatus := stdoutCanUpdateStatus()
return progress.New(interval, max, func(v uint64, max uint64, d time.Duration, final bool) {
return progress.NewCounter(interval, max, func(v uint64, max uint64, d time.Duration, final bool) {
var status string
if max == 0 {
status = fmt.Sprintf("[%s] %d %s",