From 30551fdede3263385367e3b7d7b10b4a964aaadf Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 8 Nov 2024 10:27:02 +0000 Subject: [PATCH] Bump github.com/schollz/progressbar/v3 from 3.16.1 to 3.17.0 Bumps [github.com/schollz/progressbar/v3](https://github.com/schollz/progressbar) from 3.16.1 to 3.17.0. - [Release notes](https://github.com/schollz/progressbar/releases) - [Commits](https://github.com/schollz/progressbar/compare/v3.16.1...v3.17.0) --- updated-dependencies: - dependency-name: github.com/schollz/progressbar/v3 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 +-- .../schollz/progressbar/v3/progressbar.go | 36 ++++++++++++++++--- vendor/modules.txt | 2 +- 4 files changed, 35 insertions(+), 9 deletions(-) diff --git a/go.mod b/go.mod index de4d7397b..2f68bd1be 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( github.com/google/go-containerregistry v0.20.2 github.com/onsi/gomega v1.35.1 github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06 - github.com/schollz/progressbar/v3 v3.16.1 + github.com/schollz/progressbar/v3 v3.17.0 github.com/shipwright-io/build v0.13.0 github.com/spf13/cobra v1.8.1 github.com/spf13/pflag v1.0.5 diff --git a/go.sum b/go.sum index 555c30b1b..391220c37 100644 --- a/go.sum +++ b/go.sum @@ -379,8 +379,8 @@ github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06 h1:OkMGxebDjyw0ULyrTYWeN0UNCCkmCWfjPnIA2W6oviI= github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06/go.mod h1:+ePHsJ1keEjQtpvf9HHw0f4ZeJ0TLRsxhunSI2hYJSs= -github.com/schollz/progressbar/v3 v3.16.1 h1:RnF1neWZFzLCoGx8yp1yF7SDl4AzNDI5y4I0aUJRrZQ= -github.com/schollz/progressbar/v3 v3.16.1/go.mod h1:I2ILR76gz5VXqYMIY/LdLecvMHDPVcQm3W/MSKi1TME= +github.com/schollz/progressbar/v3 v3.17.0 h1:Fv+vG6O6jnJwdjCelvfyYO7sF2jaUGQVmdH4CxcZdsQ= +github.com/schollz/progressbar/v3 v3.17.0/go.mod h1:5H4fLgifX+KeQCsEJnZTOepgZLe1jFF1lpPXb68IJTA= github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ= github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= github.com/shipwright-io/build v0.13.0 h1:UBap+Mk6P0fji/sLc3eBmDlAPWvZWE4KdSQiVUkwYEU= diff --git a/vendor/github.com/schollz/progressbar/v3/progressbar.go b/vendor/github.com/schollz/progressbar/v3/progressbar.go index 51be10162..251e5833f 100644 --- a/vendor/github.com/schollz/progressbar/v3/progressbar.go +++ b/vendor/github.com/schollz/progressbar/v3/progressbar.go @@ -83,6 +83,9 @@ type config struct { showIterationsPerSecond bool showIterationsCount bool + // whether the progress bar should show the total bytes (e.g. 23/24 or 23/-, vs. just 23). + showTotalBytes bool + // whether the progress bar should show elapsed time. // always enabled if predictTime is true. elapsedTime bool @@ -309,6 +312,13 @@ func OptionShowElapsedTimeOnFinish() Option { } } +// OptionShowTotalBytes will keep the display of total bytes. +func OptionShowTotalBytes(flag bool) Option { + return func(p *ProgressBar) { + p.config.showTotalBytes = flag + } +} + // OptionSetItsString sets what's displayed for iterations a second. The default is "it" which would display: "it/s" func OptionSetItsString(iterationString string) Option { return func(p *ProgressBar) { @@ -403,6 +413,7 @@ func NewOptions64(max int64, options ...Option) *ProgressBar { spinnerType: 9, invisible: false, spinnerChangeInterval: 100 * time.Millisecond, + showTotalBytes: true, }, } @@ -482,6 +493,7 @@ func DefaultBytes(maxBytes int64, description ...string) *ProgressBar { OptionSetDescription(desc), OptionSetWriter(os.Stderr), OptionShowBytes(true), + OptionShowTotalBytes(true), OptionSetWidth(10), OptionThrottle(65*time.Millisecond), OptionShowCount(), @@ -508,6 +520,7 @@ func DefaultBytesSilent(maxBytes int64, description ...string) *ProgressBar { OptionSetDescription(desc), OptionSetWriter(io.Discard), OptionShowBytes(true), + OptionShowTotalBytes(true), OptionSetWidth(10), OptionThrottle(65*time.Millisecond), OptionShowCount(), @@ -528,6 +541,7 @@ func Default(max int64, description ...string) *ProgressBar { OptionSetDescription(desc), OptionSetWriter(os.Stderr), OptionSetWidth(10), + OptionShowTotalBytes(true), OptionThrottle(65*time.Millisecond), OptionShowCount(), OptionShowIts(), @@ -554,6 +568,7 @@ func DefaultSilent(max int64, description ...string) *ProgressBar { OptionSetDescription(desc), OptionSetWriter(io.Discard), OptionSetWidth(10), + OptionShowTotalBytes(true), OptionThrottle(65*time.Millisecond), OptionShowCount(), OptionShowIts(), @@ -1010,21 +1025,32 @@ func renderProgressBar(c config, s *state) (int, error) { if c.showBytes { currentHumanize, currentSuffix := humanizeBytes(s.currentBytes, c.useIECUnits) if currentSuffix == c.maxHumanizedSuffix { - sb.WriteString(fmt.Sprintf("%s/%s%s", - currentHumanize, c.maxHumanized, c.maxHumanizedSuffix)) - } else { + if c.showTotalBytes { + sb.WriteString(fmt.Sprintf("%s/%s%s", + currentHumanize, c.maxHumanized, c.maxHumanizedSuffix)) + } else { + sb.WriteString(fmt.Sprintf("%s%s", + currentHumanize, c.maxHumanizedSuffix)) + } + } else if c.showTotalBytes { sb.WriteString(fmt.Sprintf("%s%s/%s%s", currentHumanize, currentSuffix, c.maxHumanized, c.maxHumanizedSuffix)) + } else { + sb.WriteString(fmt.Sprintf("%s%s", currentHumanize, currentSuffix)) } - } else { + } else if c.showTotalBytes { sb.WriteString(fmt.Sprintf("%.0f/%d", s.currentBytes, c.max)) + } else { + sb.WriteString(fmt.Sprintf("%.0f", s.currentBytes)) } } else { if c.showBytes { currentHumanize, currentSuffix := humanizeBytes(s.currentBytes, c.useIECUnits) sb.WriteString(fmt.Sprintf("%s%s", currentHumanize, currentSuffix)) - } else { + } else if c.showTotalBytes { sb.WriteString(fmt.Sprintf("%.0f/%s", s.currentBytes, "-")) + } else { + sb.WriteString(fmt.Sprintf("%.0f", s.currentBytes)) } } } diff --git a/vendor/modules.txt b/vendor/modules.txt index 8de5111e5..8d51bf057 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -311,7 +311,7 @@ github.com/russross/blackfriday/v2 # github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06 ## explicit; go 1.13 github.com/sabhiram/go-gitignore -# github.com/schollz/progressbar/v3 v3.16.1 +# github.com/schollz/progressbar/v3 v3.17.0 ## explicit; go 1.22 github.com/schollz/progressbar/v3 # github.com/shipwright-io/build v0.13.0