Codebase list golang-github-vbauerster-mpb / 8901dc9
examples refactoring Vladimir Bauer 6 years ago
8 changed file(s) with 8 addition(s) and 8 deletion(s). Raw diff Collapse all Expand all
11
22 go 1.13
33
4 require github.com/vbauerster/mpb/v4 v4.11.2
4 require github.com/vbauerster/mpb/v4 v4.11.3-0.20200204150524-c0b52b31e85a
2323 name := fmt.Sprintf("Bar#%d:", i)
2424 bar := p.AddBar(int64(total),
2525 // set BarWidth 40 for bar 1 and 2
26 mpb.BarOptOnCond(mpb.BarWidth(40), func() bool { return i > 0 }),
26 mpb.BarOptOn(mpb.BarWidth(40), func() bool { return i > 0 }),
2727 mpb.PrependDecorators(
2828 // simple name decorator
2929 decor.Name(name),
11
22 go 1.13
33
4 require github.com/vbauerster/mpb/v4 v4.11.2
4 require github.com/vbauerster/mpb/v4 v4.11.3-0.20200204150524-c0b52b31e85a
2222 // pass &wg (optional), so p will wait for it eventually
2323 p := mpb.New(
2424 mpb.WithWaitGroup(&wg),
25 mpb.ContainerOptOnCond(
25 mpb.ContainerOptOn(
2626 // setting to nil will:
2727 // set output to ioutil.Discard and disable internal refresh rate
2828 // cycling, in order to not consume much CPU, hovewer a single refresh
11
22 go 1.13
33
4 require github.com/vbauerster/mpb/v4 v4.11.2
4 require github.com/vbauerster/mpb/v4 v4.11.3-0.20200204150524-c0b52b31e85a
1919 for i := 0; i < numBars; i++ {
2020 name := fmt.Sprintf("Bar#%d:", i)
2121 b := p.AddBar(int64(total), mpb.BarID(i),
22 mpb.BarOptOnCond(mpb.BarRemoveOnComplete(), func() bool { return i == 0 }),
22 mpb.BarOptOn(mpb.BarRemoveOnComplete(), func() bool { return i == 0 }),
2323 mpb.PrependDecorators(
2424 decor.Name(name),
2525 decor.EwmaETA(decor.ET_STYLE_GO, 60, decor.WCSyncSpace),
11
22 go 1.13
33
4 require github.com/vbauerster/mpb/v4 v4.11.2
4 require github.com/vbauerster/mpb/v4 v4.11.3-0.20200204150524-c0b52b31e85a
2020 name := fmt.Sprintf("Bar#%d:", i)
2121 bar := p.AddBar(int64(total),
2222 // reverse Bar#1
23 mpb.BarOptOnCond(mpb.BarReverse(), func() bool { return i == 1 }),
23 mpb.BarOptOn(mpb.BarReverse(), func() bool { return i == 1 }),
2424 mpb.PrependDecorators(
2525 // simple name decorator
2626 decor.Name(name),