Codebase list golang-github-vbauerster-mpb / 42d21d1
examples update Vladimir Bauer 9 years ago
10 changed file(s) with 17 addition(s) and 17 deletion(s). Raw diff Collapse all Expand all
1818 return fmt.Sprintf("%-7s", str)
1919 }
2020
21 p := mpb.New()
21 p := mpb.New(nil)
2222 bar := p.AddBar(totalItem).PrependFunc(decor).AppendETA(-6)
2323
2424 blockSize := rand.Intn(maxBlockSize) + 1
1818 url2 := "https://homebrew.bintray.com/bottles/libtiff-4.0.7.sierra.bottle.tar.gz"
1919
2020 var wg sync.WaitGroup
21 p := mpb.New().SetWidth(60)
21 p := mpb.New(nil).SetWidth(60)
2222
2323 for i, url := range [...]string{url1, url2} {
2424 wg.Add(1)
5858 }
5959
6060 // create bar with appropriate decorators
61 bar := p.AddBar(int(size)).
61 bar := p.AddBar(size).
6262 PrependName(name, len(name)).
6363 PrependCounters(mpb.UnitBytes, 20).
6464 AppendETA(-6)
3434 }
3535 defer dest.Close()
3636
37 p := mpb.New().SetWidth(64)
37 p := mpb.New(nil).SetWidth(64)
3838
39 bar := p.AddBar(int(size)).PrependCounters(mpb.UnitBytes, 20).AppendETA(-6)
39 bar := p.AddBar(size).PrependCounters(mpb.UnitBytes, 20).AppendETA(-6)
4040
4141 // create proxy reader
4242 reader := bar.ProxyReader(resp.Body)
1515 func main() {
1616
1717 var wg sync.WaitGroup
18 p := mpb.New().SetWidth(64)
19 // p := mpb.New().RefreshRate(80 * time.Millisecond).SetWidth(64)
18 p := mpb.New(nil).SetWidth(64)
19 // p := mpb.New(nil).RefreshRate(80 * time.Millisecond).SetWidth(64)
2020
2121 name1 := "Bar#1: "
2222 bar1 := p.AddBar(50).
1515 func main() {
1616
1717 var wg sync.WaitGroup
18 p := mpb.New().SetWidth(64)
19 // p := mpb.New().RefreshRate(80 * time.Millisecond).SetWidth(64)
18 p := mpb.New(nil).SetWidth(64)
19 // p := mpb.New(nil).RefreshRate(80 * time.Millisecond).SetWidth(64)
2020
2121 name1 := "Bar#1: "
2222 bar1 := p.AddBar(50).
1515 func main() {
1616
1717 var wg sync.WaitGroup
18 p := mpb.New().SetWidth(64)
19 // p := mpb.New().RefreshRate(100 * time.Millisecond).SetWidth(64)
18 p := mpb.New(nil).SetWidth(64)
19 // p := mpb.New(nil).RefreshRate(100 * time.Millisecond).SetWidth(64)
2020
2121 name1 := "Bar#1: "
2222 bar1 := p.AddBar(50).
1010
1111 func main() {
1212 var wg sync.WaitGroup
13 p := mpb.New() // Star mpb's rendering goroutine
13 p := mpb.New(nil) // Star mpb's rendering goroutine
1414 for i := 0; i < 3; i++ {
1515 wg.Add(1) // add wg delta
1616 name := fmt.Sprintf("Bar#%d:", i)
1010 func main() {
1111
1212 name := "Single bar:"
13 p := mpb.New()
13 p := mpb.New(nil)
1414 bar := p.AddBar(100).PrependName(name, 0).AppendPercentage()
1515
1616 for i := 0; i < 100; i++ {
1515 func main() {
1616
1717 var wg sync.WaitGroup
18 p := mpb.New().SetWidth(60).WithSort(mpb.SortTop)
18 p := mpb.New(nil).SetWidth(60).WithSort(mpb.SortTop)
1919
2020 name1 := "Bar#1: "
2121 bar1 := p.AddBar(100).
1919 UnitBytes
2020 )
2121
22 func Format(i int) *formatter {
22 func Format(i int64) *formatter {
2323 return &formatter{n: i}
2424 }
2525
2626 type formatter struct {
27 n int
27 n int64
2828 unit Units
2929 width int
3030 }
4848 }
4949 }
5050
51 func formatBytes(i int) (result string) {
51 func formatBytes(i int64) (result string) {
5252 switch {
5353 case i > bytesInTiB:
5454 result = fmt.Sprintf("%.1fTiB", float64(i)/bytesInTiB)