package rename to mpb
Vladimir Bauer
9 years ago
| 4 | 4 | "math/rand" |
| 5 | 5 | "time" |
| 6 | 6 | |
| 7 | "github.com/vbauerster/uiprogress" | |
| 7 | "github.com/vbauerster/mpb" | |
| 8 | 8 | ) |
| 9 | 9 | |
| 10 | 10 | const ( |
| 12 | 12 | ) |
| 13 | 13 | |
| 14 | 14 | func main() { |
| 15 | decor := func(s *uiprogress.Statistics) string { | |
| 15 | decor := func(s *mpb.Statistics) string { | |
| 16 | 16 | str := fmt.Sprintf("%d/%d", s.Completed, s.Total) |
| 17 | 17 | return fmt.Sprintf("%-7s", str) |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | p := uiprogress.New().RefreshRate(80 * time.Millisecond) | |
| 20 | p := mpb.New().RefreshRate(80 * time.Millisecond) | |
| 21 | 21 | |
| 22 | 22 | bar1 := p.AddBar(50).AppendETA().PrependFunc(decor) |
| 23 | 23 | go func() { |