Codebase list golang-github-vbauerster-mpb / 26cd396
singleBar example update Vladimir Bauer 9 years ago
1 changed file(s) with 4 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
00 package main
11
22 import (
3 "fmt"
34 "math/rand"
45 "time"
56
1011 // Star mpb's rendering goroutine.
1112 p := mpb.New()
1213 // Set custom width for every bar, which mpb will render
13 // The default one in 70
14 p.SetWidth(80)
14 // The default one in 80
15 p.SetWidth(100)
1516 // Set custom format for every bar, the default one is "[=>-]"
1617 p.Format("╢▌▌░╟")
1718 // Set custom refresh rate, the default one is 100 ms
2728
2829 // Don't forget to stop mpb's rendering goroutine
2930 p.Stop()
30
31 // You cannot add bars after p.Stop() has been called
32 // p.AddBar(100) // will panic
31 fmt.Println("Stop")
3332 }