build(deps): bump github.com/vbauerster/mpb/v8 from 8.1.6 to 8.2.0

Bumps [github.com/vbauerster/mpb/v8](https://github.com/vbauerster/mpb) from 8.1.6 to 8.2.0.
- [Release notes](https://github.com/vbauerster/mpb/releases)
- [Commits](https://github.com/vbauerster/mpb/compare/v8.1.6...v8.2.0)

---
updated-dependencies:
- dependency-name: github.com/vbauerster/mpb/v8
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
This commit is contained in:
dependabot[bot]
2023-02-20 12:20:18 +00:00
committed by GitHub
parent 37352a0c8c
commit 5056bd45f8
14 changed files with 459 additions and 344 deletions

View File

@@ -39,10 +39,23 @@ func WithRefreshRate(d time.Duration) ContainerOption {
// WithManualRefresh disables internal auto refresh time.Ticker.
// Refresh will occur upon receive value from provided ch.
func WithManualRefresh(ch chan interface{}) ContainerOption {
func WithManualRefresh(ch <-chan interface{}) ContainerOption {
return func(s *pState) {
s.manualRefresh = ch
s.disableAutoRefresh = true
s.manualRefresh = true
go func(refreshCh chan<- time.Time, done <-chan struct{}) {
for {
select {
case x := <-ch:
if t, ok := x.(time.Time); ok {
refreshCh <- t
} else {
refreshCh <- time.Now()
}
case <-done:
return
}
}
}(s.refreshCh, s.ctx.Done())
}
}
@@ -56,30 +69,23 @@ func WithRenderDelay(ch <-chan struct{}) ContainerOption {
}
}
// WithShutdownNotifier provided chanel will be closed, after all bars
// have been rendered.
func WithShutdownNotifier(ch chan struct{}) ContainerOption {
// WithShutdownNotifier value of type `[]*mpb.Bar` will be send into provided
// channel upon container shutdown.
func WithShutdownNotifier(ch chan<- interface{}) ContainerOption {
return func(s *pState) {
select {
case <-ch:
default:
s.shutdownNotifier = ch
}
s.shutdownNotifier = ch
}
}
// WithOutput overrides default os.Stdout output. Setting it to nil
// will effectively disable auto refresh rate and discard any output,
// useful if you want to disable progress bars with little overhead.
// WithOutput overrides default os.Stdout output. If underlying io.Writer
// is not a terminal then auto refresh is disabled unless WithAutoRefresh
// option is set.
func WithOutput(w io.Writer) ContainerOption {
var discarded bool
if w == nil {
w = io.Discard
discarded = true
}
return func(s *pState) {
s.output = w
s.outputDiscarded = discarded
}
}
@@ -93,6 +99,14 @@ func WithDebugOutput(w io.Writer) ContainerOption {
}
}
// WithAutoRefresh force auto refresh regardless of what output is set to.
// Applicable only if not WithManualRefresh set.
func WithAutoRefresh() ContainerOption {
return func(s *pState) {
s.autoRefresh = true
}
}
// PopCompletedMode will pop completed bars to the top.
// To stop rendering bar after it has been popped, use
// mpb.BarRemoveOnComplete() option on that bar.