Codebase list golang-github-vbauerster-mpb / 6ab3f73
use BarOptional Vladimir Bauer 5 years ago
3 changed file(s) with 3 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
2323 name := fmt.Sprintf("Bar#%d:", i)
2424 bar := p.AddBar(int64(total),
2525 // set BarWidth 40 for bar 1 and 2
26 mpb.BarOptOn(mpb.BarWidth(40), func() bool { return i > 0 }),
26 mpb.BarOptional(mpb.BarWidth(40), i > 0),
2727 mpb.PrependDecorators(
2828 // simple name decorator
2929 decor.Name(name),
2020 name := fmt.Sprintf("Bar#%d:", i)
2121 bar := p.AddBar(int64(total),
2222 mpb.BarID(i),
23 mpb.BarOptOn(mpb.BarRemoveOnComplete(), func() bool { return i == 0 }),
23 mpb.BarOptional(mpb.BarRemoveOnComplete(), i == 0),
2424 mpb.PrependDecorators(
2525 decor.Name(name),
2626 decor.EwmaETA(decor.ET_STYLE_GO, 60, decor.WCSyncSpace),
130130 p := mpb.New(mpb.WithOutput(ioutil.Discard))
131131 for i := 0; i < numBars; i++ {
132132 bar := p.AddBar(int64(total),
133 mpb.BarOptOn(mpb.BarRemoveOnComplete(), func() bool { return i == 0 }),
133 mpb.BarOptional(mpb.BarRemoveOnComplete(), i == 0),
134134 mpb.PrependDecorators(
135135 decor.EwmaETA(decor.ET_STYLE_GO, 60, decor.WCSyncSpace),
136136 ),