fix(deps): update module github.com/vbauerster/mpb/v8 to v8.9.2

Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
This commit is contained in:
renovate[bot]
2025-02-07 12:39:09 +00:00
committed by GitHub
parent 2cbb5fead9
commit 1d4c67751c
7 changed files with 33 additions and 34 deletions

View File

@ -117,7 +117,7 @@ func (b *Bar) ProxyWriter(w io.Writer) io.WriteCloser {
}
}
// ID returs id of the bar.
// ID returns id of the bar.
func (b *Bar) ID() int {
result := make(chan int)
select {
@ -180,7 +180,7 @@ func (b *Bar) TraverseDecorators(cb func(decor.Decorator)) {
}
// EnableTriggerComplete enables triggering complete event. It's effective
// only for bars which were constructed with `total <= 0`. If `curren >= total`
// only for bars which were constructed with `total <= 0`. If `current >= total`
// at the moment of call, complete event is triggered right away.
func (b *Bar) EnableTriggerComplete() {
select {
@ -493,7 +493,7 @@ func (b *Bar) wSyncTable() syncTable {
func (s *bState) draw(stat decor.Statistics) (_ io.Reader, err error) {
decorFiller := func(buf *bytes.Buffer, decorators []decor.Decorator) (err error) {
for _, d := range decorators {
// need to call Decor in any case becase of width synchronization
// need to call Decor in any case because of width synchronization
str, width := d.Decor(stat)
if err != nil {
continue

View File

@ -15,7 +15,7 @@ var (
_ AverageDecorator = (*averageETA)(nil)
)
// TimeNormalizer interface. Implementors could be passed into
// TimeNormalizer interface. Implementers could be passed into
// MovingAverageETA, in order to affect i.e. normalize its output.
type TimeNormalizer interface {
Normalize(time.Duration) time.Duration

View File

@ -28,14 +28,14 @@ const (
// appropriate size marker (KiB, MiB, GiB, TiB).
type SizeB1024 int64
func (self SizeB1024) Format(st fmt.State, verb rune) {
func (s SizeB1024) Format(f fmt.State, verb rune) {
prec := -1
switch verb {
case 'f', 'e', 'E':
prec = 6 // default prec of fmt.Printf("%f|%e|%E")
fallthrough
case 'b', 'g', 'G', 'x', 'X':
if p, ok := st.Precision(); ok {
if p, ok := f.Precision(); ok {
prec = p
}
default:
@ -44,24 +44,24 @@ func (self SizeB1024) Format(st fmt.State, verb rune) {
var unit SizeB1024
switch {
case self < _iKiB:
case s < _iKiB:
unit = _ib
case self < _iMiB:
case s < _iMiB:
unit = _iKiB
case self < _iGiB:
case s < _iGiB:
unit = _iMiB
case self < _iTiB:
case s < _iTiB:
unit = _iGiB
default:
unit = _iTiB
}
b := strconv.AppendFloat(make([]byte, 0, 24), float64(self)/float64(unit), byte(verb), prec, 64)
if st.Flag(' ') {
b := strconv.AppendFloat(make([]byte, 0, 24), float64(s)/float64(unit), byte(verb), prec, 64)
if f.Flag(' ') {
b = append(b, ' ')
}
b = append(b, []byte(unit.String())...)
_, err := st.Write(b)
_, err := f.Write(b)
if err != nil {
panic(err)
}
@ -80,14 +80,14 @@ const (
// appropriate size marker (KB, MB, GB, TB).
type SizeB1000 int64
func (self SizeB1000) Format(st fmt.State, verb rune) {
func (s SizeB1000) Format(f fmt.State, verb rune) {
prec := -1
switch verb {
case 'f', 'e', 'E':
prec = 6 // default prec of fmt.Printf("%f|%e|%E")
fallthrough
case 'b', 'g', 'G', 'x', 'X':
if p, ok := st.Precision(); ok {
if p, ok := f.Precision(); ok {
prec = p
}
default:
@ -96,24 +96,24 @@ func (self SizeB1000) Format(st fmt.State, verb rune) {
var unit SizeB1000
switch {
case self < _KB:
case s < _KB:
unit = _b
case self < _MB:
case s < _MB:
unit = _KB
case self < _GB:
case s < _GB:
unit = _MB
case self < _TB:
case s < _TB:
unit = _GB
default:
unit = _TB
}
b := strconv.AppendFloat(make([]byte, 0, 24), float64(self)/float64(unit), byte(verb), prec, 64)
if st.Flag(' ') {
b := strconv.AppendFloat(make([]byte, 0, 24), float64(s)/float64(unit), byte(verb), prec, 64)
if f.Flag(' ') {
b = append(b, ' ')
}
b = append(b, []byte(unit.String())...)
_, err := st.Write(b)
_, err := f.Write(b)
if err != nil {
panic(err)
}

View File

@ -17,8 +17,8 @@ import (
const defaultRefreshRate = 150 * time.Millisecond
const defaultHmQueueLength = 128
// DoneError represents use after `(*Progress).Wait()` error.
var DoneError = fmt.Errorf("%T instance can't be reused after %[1]T.Wait()", (*Progress)(nil))
// ErrDone represents use after `(*Progress).Wait()` error.
var ErrDone = fmt.Errorf("%T instance can't be reused after %[1]T.Wait()", (*Progress)(nil))
// Progress represents a container that renders one or more progress bars.
type Progress struct {
@ -39,7 +39,7 @@ type pState struct {
idCount int
popPriority int
// following are provided/overrided by user
// following are provided/overrode by user
hmQueueLen int
reqWidth int
refreshRate time.Duration
@ -149,7 +149,7 @@ func (p *Progress) MustAdd(total int64, filler BarFiller, options ...BarOption)
// Add creates a bar which renders itself by provided BarFiller.
// If `total <= 0` triggering complete event by increment methods
// is disabled. If called after `(*Progress).Wait()` then
// `(nil, DoneError)` is returned.
// `(nil, ErrDone)` is returned.
func (p *Progress) Add(total int64, filler BarFiller, options ...BarOption) (*Bar, error) {
if filler == nil {
filler = NopStyle().Build()
@ -171,7 +171,7 @@ func (p *Progress) Add(total int64, filler BarFiller, options ...BarOption) (*Ba
}:
return <-ch, nil
case <-p.done:
return nil, DoneError
return nil, ErrDone
}
}
@ -205,8 +205,7 @@ func (p *Progress) UpdateBarPriority(b *Bar, priority int, lazy bool) {
// Write is implementation of io.Writer.
// Writing to `*Progress` will print lines above a running bar.
// Writes aren't flushed immediately, but at next refresh cycle.
// If called after `(*Progress).Wait()` then `(0, DoneError)`
// is returned.
// If called after `(*Progress).Wait()` then `(0, ErrDone)` is returned.
func (p *Progress) Write(b []byte) (int, error) {
type result struct {
n int
@ -221,7 +220,7 @@ func (p *Progress) Write(b []byte) (int, error) {
res := <-ch
return res.n, res.err
case <-p.done:
return 0, DoneError
return 0, ErrDone
}
}