Codebase list golang-github-vbauerster-mpb / 4f9fd24
WithWidth 64 Vladimir Bauer 8 years ago
2 changed file(s) with 4 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
1212 }
1313
1414 func main() {
15 p := mpb.New()
15 p := mpb.New(mpb.WithWidth(64))
1616
1717 // initialize bar with dynamic total and initial total guess = 80
1818 bar := p.AddBar(80,
2424 decor.CountersNoUnit("%d / %d", 12, 0),
2525 ),
2626 mpb.AppendDecorators(
27 decor.Percentage(5, 0),
27 decor.Percentage(4, 0),
2828 ),
2929 )
3030
1919 url2 := "https://homebrew.bintray.com/bottles/libtiff-4.0.7.sierra.bottle.tar.gz"
2020
2121 var wg sync.WaitGroup
22 p := mpb.New(mpb.WithWaitGroup(&wg))
22 p := mpb.New(mpb.WithWidth(64), mpb.WithWaitGroup(&wg))
2323
2424 for i, url := range [...]string{url1, url2} {
2525 wg.Add(1)
2828 }
2929
3030 p.Wait()
31 fmt.Println("done")
3231 }
3332
3433 func download(wg *sync.WaitGroup, p *mpb.Progress, name, url string, n int) {
6362 decor.StaticName(name, len(name)+1, decor.DidentRight),
6463 decor.CountersKibiByte("%6.1f / %6.1f", 0, decor.DwidthSync),
6564 ),
66 mpb.AppendDecorators(decor.ETA(3, 0)),
65 mpb.AppendDecorators(decor.ETA(0, decor.DwidthSync)),
6766 )
6867
6968 // create proxy reader