diff --git a/_examples/decoratorsOnTop/main.go b/_examples/decoratorsOnTop/main.go index c9fb9b7..379ce8f 100644 --- a/_examples/decoratorsOnTop/main.go +++ b/_examples/decoratorsOnTop/main.go @@ -24,7 +24,7 @@ decor.AverageETA(decor.ET_STYLE_GO), "done", ), ), - mpb.BarExtender(nlBarFiller(mpb.NewBarFiller("╢▌▌░╟", false))), + mpb.BarExtender(nlBarFiller(mpb.NewBarFiller("╢▌▌░╟"))), ) // simulating some work max := 100 * time.Millisecond diff --git a/_examples/dynTotal/main.go b/_examples/dynTotal/main.go index 55e8c0e..a283cf5 100644 --- a/_examples/dynTotal/main.go +++ b/_examples/dynTotal/main.go @@ -17,6 +17,7 @@ p := mpb.New(mpb.WithWidth(64)) var total int64 + // new bar with 'trigger complete event' disabled, because total is zero bar := p.AddBar(total, mpb.PrependDecorators(decor.Counters(decor.UnitKiB, "% .1f / % .1f")), mpb.AppendDecorators(decor.Percentage()), diff --git a/_examples/io/main.go b/_examples/io/main.go index 00a6dcd..1a4464b 100644 --- a/_examples/io/main.go +++ b/_examples/io/main.go @@ -19,7 +19,8 @@ mpb.WithRefreshRate(180*time.Millisecond), ) - bar := p.AddBar(total, mpb.BarStyle("[=>-|"), + bar := p.Add(total, + mpb.NewBarFiller("[=>-|"), mpb.PrependDecorators( decor.CountersKibiByte("% .2f / % .2f"), ), diff --git a/_examples/reverseBar/main.go b/_examples/reverseBar/main.go index 2993f50..2ea06c7 100644 --- a/_examples/reverseBar/main.go +++ b/_examples/reverseBar/main.go @@ -19,9 +19,9 @@ for i := 0; i < numBars; i++ { name := fmt.Sprintf("Bar#%d:", i) - bar := p.AddBar(int64(total), + bar := p.Add(int64(total), // reverse Bar#1 - mpb.BarOptOn(mpb.BarReverse(), func() bool { return i == 1 }), + mpb.NewBarFillerRev("", func() bool { return i == 1 }), mpb.PrependDecorators( // simple name decorator decor.Name(name), diff --git a/_examples/singleBar/main.go b/_examples/singleBar/main.go index 5c6029f..ca7ae4d 100644 --- a/_examples/singleBar/main.go +++ b/_examples/singleBar/main.go @@ -15,9 +15,9 @@ total := 100 name := "Single Bar:" // adding a single bar, which will inherit container's width - bar := p.AddBar(int64(total), - // override DefaultBarStyle, which is "[=>-]<+" - mpb.BarStyle("╢▌▌░╟"), + bar := p.Add(int64(total), + // progress bar filler with customized style + mpb.NewBarFiller("╢▌▌░╟"), mpb.PrependDecorators( // display our name with one space on the right decor.Name(name, decor.WC{W: len(name) + 1, C: decor.DidentRight}), diff --git a/_examples/spinnerBar/main.go b/_examples/spinnerBar/main.go index fb4d910..4f67b35 100644 --- a/_examples/spinnerBar/main.go +++ b/_examples/spinnerBar/main.go @@ -14,18 +14,19 @@ var wg sync.WaitGroup p := mpb.New( mpb.WithWaitGroup(&wg), - mpb.WithWidth(13), + mpb.WithWidth(14), ) total, numBars := 101, 3 wg.Add(numBars) + + spinnerStyle := []string{"∙∙∙", "●∙∙", "∙●∙", "∙∙●", "∙∙∙"} for i := 0; i < numBars; i++ { name := fmt.Sprintf("Bar#%d:", i) var bar *mpb.Bar if i == 0 { - bar = p.AddBar(int64(total), - // override mpb.DefaultBarStyle, which is "[=>-]<+" - mpb.BarStyle("╢▌▌░╟"), + bar = p.Add(int64(total), + mpb.NewBarFiller("╢▌▌░╟"), mpb.PrependDecorators( // simple name decorator decor.Name(name), @@ -39,9 +40,8 @@ ), ) } else { - bar = p.AddSpinner(int64(total), mpb.SpinnerOnMiddle, - // override mpb.DefaultSpinnerStyle - mpb.SpinnerStyle([]string{"∙∙∙", "●∙∙", "∙●∙", "∙∙●", "∙∙∙"}), + bar = p.Add(int64(total), + mpb.NewSpinnerFiller(spinnerStyle, mpb.SpinnerOnMiddle), mpb.PrependDecorators( // simple name decorator decor.Name(name), diff --git a/_examples/suppressBar/main.go b/_examples/suppressBar/main.go index f0026e3..9f17a0b 100644 --- a/_examples/suppressBar/main.go +++ b/_examples/suppressBar/main.go @@ -42,12 +42,8 @@ } }) }), - mpb.PrependDecorators( - decor.Name("my bar:"), - ), - mpb.AppendDecorators( - newCustomPercentage(nextCh), - ), + mpb.PrependDecorators(decor.Name("my bar:")), + mpb.AppendDecorators(newCustomPercentage(nextCh)), ) ew := &errorWrapper{} time.AfterFunc(2*time.Second, func() {