Codebase list golang-github-vbauerster-mpb / 81e2db1
AppendETA signature change Vladimir Bauer 9 years ago
4 changed file(s) with 7 addition(s) and 7 deletion(s). Raw diff Collapse all Expand all
4040 }
4141
4242 func (b *Bar) PrependETA(padding int) *Bar {
43 layout := "ETA% " + strconv.Itoa(padding) + "s"
43 layout := "ETA%" + strconv.Itoa(padding) + "s"
4444 b.PrependFunc(func(s *Statistics) string {
4545 return fmt.Sprintf(layout, time.Duration(s.Eta().Seconds())*time.Second)
4646 })
4848 }
4949
5050 func (b *Bar) AppendETA(padding int) *Bar {
51 layout := "ETA% " + strconv.Itoa(padding) + "s"
51 layout := "ETA %" + strconv.Itoa(padding) + "s"
5252 b.AppendFunc(func(s *Statistics) string {
5353 return fmt.Sprintf(layout, time.Duration(s.Eta().Seconds())*time.Second)
5454 })
1919 }
2020
2121 p := mpb.New()
22 bar := p.AddBar(totalItem).AppendETA().PrependFunc(decor)
22 bar := p.AddBar(totalItem).PrependFunc(decor).AppendETA(-6)
2323
2424 blockSize := rand.Intn(maxBlockSize) + 1
2525 // Fallowing will hang, to prevent
3636
3737 p := mpb.New().SetWidth(64)
3838
39 bar := p.AddBar(int(size)).PrependCounters(mpb.UnitBytes, 20).AppendETA()
39 bar := p.AddBar(int(size)).PrependCounters(mpb.UnitBytes, 20).AppendETA(-6)
4040
4141 // create proxy reader
4242 reader := bar.ProxyReader(resp.Body)
2020 name1 := "Bar#1: "
2121 bar1 := p.AddBar(100).
2222 PrependName(name1, len(name1)).PrependFunc(getDecor()).
23 AppendETA()
23 AppendETA(-6)
2424 wg.Add(1)
2525 go func() {
2626 defer wg.Done()
3434
3535 bar2 := p.AddBar(60).
3636 PrependName("", 0-len(name1)).PrependFunc(getDecor()).
37 AppendETA()
37 AppendETA(-6)
3838 wg.Add(1)
3939 go func() {
4040 defer wg.Done()
4848
4949 bar3 := p.AddBar(80).
5050 PrependName("Bar#3: ", 0).PrependFunc(getDecor()).
51 AppendETA()
51 AppendETA(-6)
5252 wg.Add(1)
5353 go func() {
5454 defer wg.Done()