Codebase list golang-github-vbauerster-mpb / c1d1b68
refactor examples Vladimir Bauer 9 years ago
4 changed file(s) with 7 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
6060 // create bar with appropriate decorators
6161 bar := p.AddBar(size).
6262 PrependName(name, 0, 0).
63 PrependCounters(mpb.UnitBytes, 18, mpb.DwidthSync|mpb.DextraSpace).
63 PrependCounters("%3s / %3s", mpb.UnitBytes, 18, mpb.DwidthSync|mpb.DextraSpace).
6464 AppendETA(5, mpb.DwidthSync)
6565
6666 // create proxy reader
3737 p := mpb.New(nil).SetWidth(64)
3838
3939 bar := p.AddBar(size).
40 PrependCounters(mpb.UnitBytes, 18, 0).
40 PrependCounters("%3s / %3s", mpb.UnitBytes, 18, 0).
4141 AppendETA(3, 0)
4242
4343 // create proxy reader
1111 func main() {
1212 var wg sync.WaitGroup
1313 p := mpb.New(nil)
14 wg.Add(3) // add wg delta
1415 for i := 0; i < 3; i++ {
15 wg.Add(1) // add wg delta
1616 name := fmt.Sprintf("Bar#%d:", i)
17 bar := p.AddBar(100).PrependName(name, len(name)).AppendPercentage()
17 bar := p.AddBar(100).
18 PrependName(name, len(name), 0).
19 AppendPercentage(5, 0)
1820 go func() {
1921 defer wg.Done()
2022 // you can p.AddBar() here, but ordering will be non deterministic
2222
2323 // Add a bar. You're not limited to just one bar, add many if you need.
2424 bar := p.AddBar(100).
25 PrependName("Single Bar:", 0, mpb.DwidthSync).
25 PrependName("Single Bar:", 0, 0).
2626 AppendPercentage(5, 0)
2727
2828 for i := 0; i < 100; i++ {