No Description

Vladimir Bauer 2dcb25df4d refactoring tryEarlyRefresh 15 hours ago
.github cc2ca9a720 link workflow derive name 7 months ago
_examples 0fc9320dc4 v8.7.0 1 week ago
_svg 2d1b96cfa9 go mod init 4 years ago
cwriter 93889dfda6 don't auto refresh if output is not terminal 9 months ago
decor fb2ad714f1 make DextraSpace effective regardless of DSyncWidth 2 weeks ago
internal 82e7b4075e drop internal predicate 2 years ago
.gitignore 33cbe2c2cc gitignore 6 years ago
CONTRIBUTING 6b8927ecb1 CONTRIBUTING 3 months ago 1fd887f548 refactoring single bar example 1 week ago
UNLICENSE d9cdda900c License change to Unlicense 4 years ago
bar.go 2dcb25df4d refactoring tryEarlyRefresh 15 hours ago
bar_filler.go 375ffd0afd move BarFillerBuilderFunc to where it's used 5 months ago
bar_filler_bar.go ce31900e9d minor: type names are self explanatory 4 months ago
bar_filler_nop.go ff5c422b1e make BarFillerBuilderFunc private 5 months ago
bar_filler_spinner.go 51d6dad595 prefer + for string concat 4 months ago
bar_option.go d62bb2d93a BarFillerMiddleware: early nil check 5 months ago
bar_test.go fab44347b8 check bar.Current() in TestBarEnableTriggerCompleteAndIncrementAfter 1 month ago
barbench_test.go aeed4b37db WithAutoRefresh bench cases 9 months ago
container_option.go fd9d418b01 update godoc for PopCompletedMode 2 months ago
decorators_test.go 329973c160 TestPercentageDwidthSyncDindentRight 1 week ago
doc.go d9cdda900c License change to Unlicense 4 years ago
draw_test.go 20bcc7227e TestDrawDoubleWidth: correct want paddings 5 months ago
example_test.go 76a22782b5 example_test: single bar example update 16 hours ago
export_test.go 08ad434bc2 TestUpdateBarPriority 9 months ago
go.mod b00b3f3191 go get -u 1 week ago
go.sum b00b3f3191 go get -u 1 week ago
heap_manager.go c8b7aca47c minor: prefer one line import 3 months ago
priority_queue.go e4a12c6115 pq refactoring 3 months ago
progress.go 2dcb25df4d refactoring tryEarlyRefresh 15 hours ago
progress_test.go 1e6e31182d TestBarPristinePopOrder 4 months ago
proxyreader.go d4d94991e9 address issue #117 1 year ago
proxyreader_test.go 10915d59da minor: refactoring names 1 year ago
proxywriter.go d4d94991e9 address issue #117 1 year ago
proxywriter_test.go 0f72572715 minor: r as io.Reader 1 year ago

Multi Progress Bar

GoDoc Test status Lint status

mpb is a Go lib for rendering progress bars in terminal applications.


  • Multiple Bars: Multiple progress bars are supported
  • Dynamic Total: Set total while bar is running
  • Dynamic Add/Remove: Dynamically add or remove bars
  • Cancellation: Cancel whole rendering process
  • Predefined Decorators: Elapsed time, ewma based ETA, Percentage, Bytes counter
  • Decorator's width sync: Synchronized decorator's width among multiple bars


Rendering single bar

package main

import (


func main() {
    // initialize progress container, with custom width
    p := mpb.New(mpb.WithWidth(64))

    total := 100
    name := "Single Bar:"
    // create a single bar, which will inherit container's width
    bar := p.New(int64(total),
        // BarFillerBuilder with custom style
            // display our name with one space on the right
            decor.Name(name, decor.WC{C: decor.DindentRight | decor.DextraSpace}),
            // replace ETA decorator with "done" message, OnComplete event
            decor.OnComplete(decor.AverageETA(decor.ET_STYLE_GO), "done"),
    // simulating some work
    max := 100 * time.Millisecond
    for i := 0; i < total; i++ {
        time.Sleep(time.Duration(rand.Intn(10)+1) * max / 10)
    // wait for our bar to complete and flush

Rendering multiple bars

    var wg sync.WaitGroup
    // passed wg will be accounted at p.Wait() call
    p := mpb.New(mpb.WithWaitGroup(&wg))
    total, numBars := 100, 3

    for i := 0; i < numBars; i++ {
        name := fmt.Sprintf("Bar#%d:", i)
        bar := p.AddBar(int64(total),
                // simple name decorator
                // decor.DSyncWidth bit enables column width synchronization
                // replace ETA decorator with "done" message, OnComplete event
                    // ETA decorator with ewma age of 30
                    decor.EwmaETA(decor.ET_STYLE_GO, 30, decor.WCSyncWidth), "done",
        // simulating some work
        go func() {
            defer wg.Done()
            rng := rand.New(rand.NewSource(time.Now().UnixNano()))
            max := 100 * time.Millisecond
            for i := 0; i < total; i++ {
                // start variable is solely for EWMA calculation
                // EWMA's unit of measure is an iteration's duration
                start := time.Now()
                time.Sleep(time.Duration(rng.Intn(10)+1) * max / 10)
                // we need to call EwmaIncrement to fulfill ewma decorator's contract
    // wait for passed wg and for all bars to complete and flush

Dynamic total

dynamic total

Complex example


Bytes counters

byte counters