fix(deps): update module github.com/schollz/progressbar/v3 to v3.14.6 (#13884)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
pull/13885/head
renovate[bot] 1 year ago committed by GitHub
parent 98a15e2303
commit fb9cae4aaa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      go.mod
  2. 7
      go.sum
  3. 21
      vendor/github.com/schollz/progressbar/v3/.golangci.yml
  4. 51
      vendor/github.com/schollz/progressbar/v3/progressbar.go
  5. 2
      vendor/modules.txt

@ -137,7 +137,7 @@ require (
github.com/prometheus/alertmanager v0.27.0
github.com/prometheus/common/sigv4 v0.1.0
github.com/richardartoul/molecule v1.0.0
github.com/schollz/progressbar/v3 v3.14.2
github.com/schollz/progressbar/v3 v3.14.6
github.com/shirou/gopsutil/v4 v4.24.0-alpha.1
github.com/thanos-io/objstore v0.0.0-20240722162417-19b0c0f0ffd8
github.com/willf/bloom v2.0.3+incompatible

@ -1694,8 +1694,8 @@ github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdh
github.com/satori/go.uuid v1.2.1-0.20181028125025-b2ce2384e17b/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.29 h1:BkTk4gynLjguayxrYxZoMZjBnAOh7ntQvUkOFmkMqPU=
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.29/go.mod h1:fCa7OJZ/9DRTnOKmxvT6pn+LPWUptQAmHF/SBJUGEcg=
github.com/schollz/progressbar/v3 v3.14.2 h1:EducH6uNLIWsr560zSV1KrTeUb/wZGAHqyMFIEa99ks=
github.com/schollz/progressbar/v3 v3.14.2/go.mod h1:aQAZQnhF4JGFtRJiw/eobaXpsqpVQAftEQ+hLGXaRc4=
github.com/schollz/progressbar/v3 v3.14.6 h1:GyjwcWBAf+GFDMLziwerKvpuS7ZF+mNTAXIB2aspiZs=
github.com/schollz/progressbar/v3 v3.14.6/go.mod h1:Nrzpuw3Nl0srLY0VlTvC4V6RL50pcEymjy6qyJAaLa0=
github.com/sean-/conswriter v0.0.0-20180208195008-f5ae3917a627/go.mod h1:7zjs06qF79/FKAJpBvFx3P8Ww4UTIMAe+lpNXDHziac=
github.com/sean-/pager v0.0.0-20180208200047-666be9bf53b5/go.mod h1:BeybITEsBEg6qbIiqJ6/Bqeq25bCLbL7YFmpaFfJDuM=
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529 h1:nn5Wsu0esKSJiIVhscUtVbo7ada43DJhG55ua/hjS5I=
@ -2301,7 +2301,7 @@ golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM=
golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
@ -2313,7 +2313,6 @@ golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U=
golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=
golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0=
golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk=
golang.org/x/term v0.22.0 h1:BbsgPEJULsl2fV/AT3v15Mjva5yXKQDyKf+TbDz7QJk=
golang.org/x/term v0.22.0/go.mod h1:F3qCibpT5AMpCRfhfT53vVJwhLtIVHhB9XDjfFvnMI4=
golang.org/x/text v0.0.0-20160726164857-2910a502d2bf/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=

@ -0,0 +1,21 @@
run:
timeout: 5m
exclude-dirs:
- vendor
- examples
linters:
enable:
- errcheck
- gocyclo
- gofmt
- goimports
- gosimple
- govet
- ineffassign
- staticcheck
- unused
linters-settings:
gocyclo:
min-complexity: 20

@ -1,6 +1,7 @@
package progressbar
import (
"bytes"
"errors"
"fmt"
"io"
@ -121,6 +122,8 @@ type config struct {
// showDescriptionAtLineEnd specifies whether description should be written at line end instead of line start
showDescriptionAtLineEnd bool
stdBuffer bytes.Buffer
}
// Theme defines the elements of the bar
@ -323,7 +326,7 @@ func NewOptions64(max int64, options ...Option) *ProgressBar {
width: 40,
max: max,
throttleDuration: 0 * time.Nanosecond,
elapsedTime: true,
elapsedTime: max == -1,
predictTime: true,
spinnerType: 9,
invisible: false,
@ -496,6 +499,9 @@ func (p *ProgressBar) Reset() {
func (p *ProgressBar) Finish() error {
p.lock.Lock()
p.state.currentNum = p.config.max
if !p.config.ignoreLength {
p.state.currentBytes = float64(p.config.max)
}
p.lock.Unlock()
return p.Add(0)
}
@ -615,11 +621,17 @@ func New64(max int64) *ProgressBar {
// GetMax returns the max of a bar
func (p *ProgressBar) GetMax() int {
p.lock.Lock()
defer p.lock.Unlock()
return int(p.config.max)
}
// GetMax64 returns the current max
func (p *ProgressBar) GetMax64() int64 {
p.lock.Lock()
defer p.lock.Unlock()
return p.config.max
}
@ -635,6 +647,8 @@ func (p *ProgressBar) ChangeMax(newMax int) {
// but takes in a int64
// to avoid casting
func (p *ProgressBar) ChangeMax64(newMax int64) {
p.lock.Lock()
p.config.max = newMax
if p.config.showBytes {
@ -642,6 +656,8 @@ func (p *ProgressBar) ChangeMax64(newMax int64) {
p.config.useIECUnits)
}
p.lock.Unlock() // so p.Add can lock
p.Add(0) // re-render
}
@ -676,6 +692,7 @@ func (p *ProgressBar) render() error {
if !p.state.finished && p.state.currentNum >= p.config.max {
p.state.finished = true
if !p.config.clearOnFinish {
io.Copy(p.config.writer, &p.config.stdBuffer)
renderProgressBar(p.config, &p.state)
}
if p.config.onCompletion != nil {
@ -694,6 +711,7 @@ func (p *ProgressBar) render() error {
}
// then, re-render the current progress bar
io.Copy(p.config.writer, &p.config.stdBuffer)
w, err := renderProgressBar(p.config, &p.state)
if err != nil {
return err
@ -840,7 +858,7 @@ func renderProgressBar(c config, s *state) (int, error) {
}
rightBrac = rightBracNum.String()
fallthrough
case c.elapsedTime:
case c.elapsedTime || c.showElapsedTimeOnFinish:
leftBrac = (time.Duration(time.Since(s.startTime).Seconds()) * time.Second).String()
}
@ -944,8 +962,7 @@ func renderProgressBar(c config, s *state) (int, error) {
strings.Repeat(c.theme.SaucerPadding, repeatAmount),
c.theme.BarEnd,
sb.String())
if s.currentPercent == 100 && c.showElapsedTimeOnFinish {
if (s.currentPercent == 100 && c.showElapsedTimeOnFinish) || c.elapsedTime {
str = fmt.Sprintf("%s [%s]", str, leftBrac)
}
@ -1069,19 +1086,19 @@ func (r *Reader) Close() (err error) {
// Write implement io.Writer
func (p *ProgressBar) Write(b []byte) (n int, err error) {
n = len(b)
p.Add(n)
err = p.Add(n)
return
}
// Read implement io.Reader
func (p *ProgressBar) Read(b []byte) (n int, err error) {
n = len(b)
p.Add(n)
err = p.Add(n)
return
}
func (p *ProgressBar) Close() (err error) {
p.Finish()
err = p.Finish()
return
}
@ -1130,3 +1147,23 @@ var termWidth = func() (width int, err error) {
return 0, err
}
func shouldCacheOutput(pb *ProgressBar) bool {
return !pb.state.finished && !pb.state.exit && !pb.config.invisible
}
func Bprintln(pb *ProgressBar, a ...interface{}) (int, error) {
if !shouldCacheOutput(pb) {
return fmt.Fprintln(pb.config.writer, a...)
} else {
return fmt.Fprintln(&pb.config.stdBuffer, a...)
}
}
func Bprintf(pb *ProgressBar, format string, a ...interface{}) (int, error) {
if !shouldCacheOutput(pb) {
return fmt.Fprintf(pb.config.writer, format, a...)
} else {
return fmt.Fprintf(&pb.config.stdBuffer, format, a...)
}
}

@ -1487,7 +1487,7 @@ github.com/rivo/uniseg
# github.com/rs/xid v1.5.0
## explicit; go 1.12
github.com/rs/xid
# github.com/schollz/progressbar/v3 v3.14.2
# github.com/schollz/progressbar/v3 v3.14.6
## explicit; go 1.13
github.com/schollz/progressbar/v3
# github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529

Loading…
Cancel
Save