README update
Vladimir Bauer
5 years ago
| 7 | 7 | |
| 8 | 8 | ## Features |
| 9 | 9 | |
| 10 | * __Multiple Bars__: Multiple progress bars are supported | |
| 11 | * __Dynamic Total__: Set total while bar is running | |
| 12 | * __Dynamic Add/Remove__: Dynamically add or remove bars | |
| 13 | * __Cancellation__: Cancel whole rendering process | |
| 14 | * __Predefined Decorators__: Elapsed time, [ewma](https://github.com/VividCortex/ewma) based ETA, Percentage, Bytes counter | |
| 15 | * __Decorator's width sync__: Synchronized decorator's width among multiple bars | |
| 10 | - **Multiple Bars**: Multiple progress bars are supported | |
| 11 | - **Dynamic Total**: Set total while bar is running | |
| 12 | - **Dynamic Add/Remove**: Dynamically add or remove bars | |
| 13 | - **Cancellation**: Cancel whole rendering process | |
| 14 | - **Predefined Decorators**: Elapsed time, [ewma](https://github.com/VividCortex/ewma) based ETA, Percentage, Bytes counter | |
| 15 | - **Decorator's width sync**: Synchronized decorator's width among multiple bars | |
| 16 | 16 | |
| 17 | 17 | ## Usage |
| 18 | 18 | |
| 19 | 19 | #### [Rendering single bar](_examples/singleBar/main.go) |
| 20 | ||
| 20 | 21 | ```go |
| 21 | 22 | package main |
| 22 | 23 | |
| 35 | 36 | total := 100 |
| 36 | 37 | name := "Single Bar:" |
| 37 | 38 | // adding a single bar, which will inherit container's width |
| 38 | bar := p.AddBar(int64(total), | |
| 39 | // override DefaultBarStyle, which is "[=>-]<+" | |
| 40 | mpb.BarStyle("╢▌▌░╟"), | |
| 39 | bar := p.Add(int64(total), | |
| 40 | // progress bar filler with customized style | |
| 41 | mpb.NewBarFiller("╢▌▌░╟"), | |
| 41 | 42 | mpb.PrependDecorators( |
| 42 | 43 | // display our name with one space on the right |
| 43 | 44 | decor.Name(name, decor.WC{W: len(name) + 1, C: decor.DidentRight}), |
| 60 | 61 | ``` |
| 61 | 62 | |
| 62 | 63 | #### [Rendering multiple bars](_examples/multiBars/main.go) |
| 64 | ||
| 63 | 65 | ```go |
| 64 | 66 | var wg sync.WaitGroup |
| 65 | 67 | // pass &wg (optional), so p will wait for it eventually |