Codebase list golang-github-vbauerster-mpb / a3060af
refactoring: examples Vladimir Bauer 5 years ago
6 changed file(s) with 12 addition(s) and 8 deletion(s). Raw diff Collapse all Expand all
2323 decor.AverageETA(decor.ET_STYLE_GO), "done",
2424 ),
2525 ),
26 mpb.BarExtender(nlBarFiller(mpb.NewBarFiller("╢▌▌░╟"))),
26 mpb.BarExtender(nlBarFiller(mpb.NewBarFiller(mpb.BarStyle()))),
2727 )
2828 // simulating some work
2929 max := 100 * time.Millisecond
1919 )
2020
2121 bar := p.Add(total,
22 mpb.NewBarFiller("[=>-|"),
22 mpb.NewBarFiller(mpb.BarStyle().Rbound("|")),
2323 mpb.PrependDecorators(
2424 decor.CountersKibiByte("% .2f / % .2f"),
2525 ),
1818
1919 for i := 0; i < numBars; i++ {
2020 name := fmt.Sprintf("Bar#%d:", i)
21 bs := mpb.BarStyle()
22 if i == 1 {
23 // reverse Bar#1
24 bs = bs.Tip("<").Reverse()
25 }
2126 bar := p.Add(int64(total),
22 // reverse Bar#1
23 mpb.NewBarFillerPick("", i == 1),
27 mpb.NewBarFiller(bs),
2428 mpb.PrependDecorators(
2529 // simple name decorator
2630 decor.Name(name),
1616 // adding a single bar, which will inherit container's width
1717 bar := p.Add(int64(total),
1818 // progress bar filler with customized style
19 mpb.NewBarFiller("╢▌▌░╟"),
19 mpb.NewBarFiller(mpb.BarStyle().Lbound("╢").Filler("▌").Tip("▌").Padding("░").Rbound("╟")),
2020 mpb.PrependDecorators(
2121 // display our name with one space on the right
2222 decor.Name(name, decor.WC{W: len(name) + 1, C: decor.DidentRight}),
2525 var bar *mpb.Bar
2626 if i == 0 {
2727 bar = p.Add(int64(total),
28 mpb.NewBarFiller("╢▌▌░╟"),
28 mpb.NewBarFiller(mpb.BarStyle().Lbound("╢").Filler("▌").Tip("▌").Padding("░").Rbound("╟")),
2929 mpb.PrependDecorators(
3030 // simple name decorator
3131 decor.Name(name),
4040 )
4141 } else {
4242 bar = p.Add(int64(total),
43 mpb.NewSpinnerFiller(spinnerStyle, mpb.SpinnerOnMiddle),
43 mpb.NewBarFiller(mpb.SpinnerStyle(spinnerStyle...)),
4444 mpb.PrependDecorators(
4545 // simple name decorator
4646 decor.Name(name),
1919 // adding a single bar, which will inherit container's width
2020 bar := p.Add(int64(total),
2121 // progress bar filler with customized style
22 mpb.NewBarFiller("╢▌▌░╟"),
22 mpb.NewBarFiller(mpb.BarStyle().Lbound("╢").Filler("▌").Tip("▌").Padding("░").Rbound("╟")),
2323 mpb.PrependDecorators(
2424 // display our name with one space on the right
2525 decor.Name(name, decor.WC{W: len(name) + 1, C: decor.DidentRight}),