Codebase list golang-github-vbauerster-mpb / 0cbe6b3
Refactor: godoc examples Vladimir Bauer 8 years ago
1 changed file(s) with 7 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
3737 ),
3838 )
3939
40 max := 200 * time.Millisecond
4041 for i := 0; i < total; i++ {
41 time.Sleep(time.Duration(rand.Intn(10)+1) * (200 * time.Millisecond) / 10)
42 time.Sleep(time.Duration(rand.Intn(10)+1) * max / 10)
4243 bar.Increment()
4344 }
4445
4748
4849 func ExampleBar_Completed() {
4950 p := mpb.New()
50 bar := p.AddBar(100, mpb.AppendDecorators(decor.Percentage(5, 0)))
51 bar := p.AddBar(100)
5152
53 max := 200 * time.Millisecond
5254 for !bar.Completed() {
53 time.Sleep(time.Duration(rand.Intn(10)+1) * (200 * time.Millisecond) / 10)
55 time.Sleep(time.Duration(rand.Intn(10)+1) * max / 10)
5456 bar.Increment()
5557 }
58
59 p.Stop()
5660 }