use ContainerOptional
Vladimir Bauer
5 years ago
| 22 | 22 | // pass &wg (optional), so p will wait for it eventually |
| 23 | 23 | p := mpb.New( |
| 24 | 24 | mpb.WithWaitGroup(&wg), |
| 25 | mpb.ContainerOptOn( | |
| 25 | mpb.ContainerOptional( | |
| 26 | 26 | // setting to nil will: |
| 27 | // set output to ioutil.Discard and disable internal refresh rate | |
| 28 | // cycling, in order to not consume much CPU, hovewer a single refresh | |
| 29 | // still will be triggered on bar complete event, per each bar. | |
| 27 | // set output to ioutil.Discard and disable refresh rate cycle, in | |
| 28 | // order not to consume much CPU. Hovewer a single refresh still will | |
| 29 | // be triggered on bar complete event, per each bar. | |
| 30 | 30 | mpb.WithOutput(nil), |
| 31 | func() bool { return quietMode }, | |
| 31 | quietMode, | |
| 32 | 32 | ), |
| 33 | 33 | ) |
| 34 | 34 | total, numBars := 100, 3 |