package example update
Vladimir Bauer
9 years ago
| 21 | 21 | p.RefreshRate(120 * time.Millisecond) |
| 22 | 22 | |
| 23 | 23 | // Add a bar. You're not limited to just one bar, add many if you need. |
| 24 | bar := p.AddBar(100).PrependName("Single Bar:", 0).AppendPercentage() | |
| 24 | bar := p.AddBar(100). | |
| 25 | PrependName("Single Bar:", 0, mpb.DwidthSync). | |
| 26 | AppendPercentage(5, 0) | |
| 25 | 27 | |
| 26 | 28 | for i := 0; i < 100; i++ { |
| 27 | 29 | bar.Incr(1) // increment progress bar |
| 37 | 39 | |
| 38 | 40 | func ExampleBar_InProgress() { |
| 39 | 41 | p := mpb.New(nil) |
| 40 | bar := p.AddBar(100).AppendPercentage() | |
| 42 | bar := p.AddBar(100).AppendPercentage(5, 0) | |
| 41 | 43 | |
| 42 | 44 | for bar.InProgress() { |
| 43 | 45 | bar.Incr(1) |