Codebase list golang-github-vbauerster-mpb / bd6b2ff
poplog: add BarRemoveOnComplete Vladimir Bauer 3 years ago
1 changed file(s) with 2 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
99 )
1010
1111 func main() {
12 rng := rand.New(rand.NewSource(time.Now().UnixNano()))
1213 p := mpb.New(mpb.PopCompletedMode())
13
1414 total, numBars := 100, 4
1515 for i := 0; i < numBars; i++ {
1616 name := fmt.Sprintf("Bar#%d:", i)
1717 bar := p.AddBar(int64(total),
1818 mpb.BarFillerOnComplete(fmt.Sprintf("%s has been completed", name)),
19 mpb.BarRemoveOnComplete(),
1920 mpb.BarFillerTrim(),
2021 mpb.PrependDecorators(
2122 decor.OnComplete(decor.Name(name), ""),
2728 ),
2829 )
2930 // simulating some work
30 rng := rand.New(rand.NewSource(time.Now().UnixNano()))
3131 max := 100 * time.Millisecond
3232 for i := 0; i < total; i++ {
3333 // start variable is solely for EWMA calculation