diff --git a/_examples/complex/main.go b/_examples/complex/main.go index e13bbc4..315d5f3 100644 --- a/_examples/complex/main.go +++ b/_examples/complex/main.go @@ -48,7 +48,7 @@ job := "installing" // preparing delayed bars b := p.AddBar(rand.Int63n(101)+100, - mpb.BarReplaceOnComplete(bars[i]), + mpb.BarParkTo(bars[i]), mpb.BarClearOnComplete(), mpb.PrependDecorators( decor.Name(task, decor.WC{W: len(task) + 1, C: decor.DidentRight}), diff --git a/bar_option.go b/bar_option.go index 86382b1..180db6b 100644 --- a/bar_option.go +++ b/bar_option.go @@ -61,10 +61,17 @@ } } -// BarReplaceOnComplete is indicator for delayed bar start, after the -// `runningBar` is complete. To achieve bar replacement effect, -// `runningBar` should has its `BarRemoveOnComplete` option set. +// BarReplaceOnComplete is deprecated. Refer to BarParkTo option. func BarReplaceOnComplete(runningBar *Bar) BarOption { + return BarParkTo(runningBar) +} + +// BarParkTo parks constructed bar into the runningBar. In other words, +// constructed bar will start only after runningBar has been completed. +// Parked bar will replace runningBar if BarRemoveOnComplete option +// is set on the runningBar. Parked bar inherits priority of the +// runningBar, if no BarPriority option is set. +func BarParkTo(runningBar *Bar) BarOption { return func(s *bState) { s.runningBar = runningBar }