v8
Vladimir Bauer
3 years ago
| 0 | 0 |
# Multi Progress Bar
|
| 1 | 1 |
|
| 2 | |
[](https://pkg.go.dev/github.com/vbauerster/mpb/v7)
|
|
2 |
[](https://pkg.go.dev/github.com/vbauerster/mpb/v8)
|
| 3 | 3 |
[](https://github.com/vbauerster/mpb/actions/workflows/test.yml)
|
| 4 | 4 |
[](https://www.paypal.me/vbauerster)
|
| 5 | 5 |
|
|
| 25 | 25 |
"math/rand"
|
| 26 | 26 |
"time"
|
| 27 | 27 |
|
| 28 | |
"github.com/vbauerster/mpb/v7"
|
| 29 | |
"github.com/vbauerster/mpb/v7/decor"
|
|
28 |
"github.com/vbauerster/mpb/v8"
|
|
29 |
"github.com/vbauerster/mpb/v8/decor"
|
| 30 | 30 |
)
|
| 31 | 31 |
|
| 32 | 32 |
func main() {
|
| 11 | 11 |
|
| 12 | 12 |
"github.com/acarl005/stripansi"
|
| 13 | 13 |
"github.com/mattn/go-runewidth"
|
| 14 | |
"github.com/vbauerster/mpb/v7/decor"
|
|
14 |
"github.com/vbauerster/mpb/v8/decor"
|
| 15 | 15 |
)
|
| 16 | 16 |
|
| 17 | 17 |
// Bar represents a progress bar.
|
| 2 | 2 |
import (
|
| 3 | 3 |
"io"
|
| 4 | 4 |
|
| 5 | |
"github.com/vbauerster/mpb/v7/decor"
|
|
5 |
"github.com/vbauerster/mpb/v8/decor"
|
| 6 | 6 |
)
|
| 7 | 7 |
|
| 8 | 8 |
// BarFiller interface.
|
| 4 | 4 |
|
| 5 | 5 |
"github.com/acarl005/stripansi"
|
| 6 | 6 |
"github.com/mattn/go-runewidth"
|
| 7 | |
"github.com/vbauerster/mpb/v7/decor"
|
| 8 | |
"github.com/vbauerster/mpb/v7/internal"
|
|
7 |
"github.com/vbauerster/mpb/v8/decor"
|
|
8 |
"github.com/vbauerster/mpb/v8/internal"
|
| 9 | 9 |
)
|
| 10 | 10 |
|
| 11 | 11 |
const (
|
| 2 | 2 |
import (
|
| 3 | 3 |
"io"
|
| 4 | 4 |
|
| 5 | |
"github.com/vbauerster/mpb/v7/decor"
|
|
5 |
"github.com/vbauerster/mpb/v8/decor"
|
| 6 | 6 |
)
|
| 7 | 7 |
|
| 8 | 8 |
// NopStyle provides BarFillerBuilder which builds NOP BarFiller.
|
| 5 | 5 |
|
| 6 | 6 |
"github.com/acarl005/stripansi"
|
| 7 | 7 |
"github.com/mattn/go-runewidth"
|
| 8 | |
"github.com/vbauerster/mpb/v7/decor"
|
| 9 | |
"github.com/vbauerster/mpb/v7/internal"
|
|
8 |
"github.com/vbauerster/mpb/v8/decor"
|
|
9 |
"github.com/vbauerster/mpb/v8/internal"
|
| 10 | 10 |
)
|
| 11 | 11 |
|
| 12 | 12 |
const (
|
| 3 | 3 |
"bytes"
|
| 4 | 4 |
"io"
|
| 5 | 5 |
|
| 6 | |
"github.com/vbauerster/mpb/v7/decor"
|
|
6 |
"github.com/vbauerster/mpb/v8/decor"
|
| 7 | 7 |
)
|
| 8 | 8 |
|
| 9 | 9 |
// BarOption is a func option to alter default behavior of a bar.
|
| 10 | 10 |
"time"
|
| 11 | 11 |
"unicode/utf8"
|
| 12 | 12 |
|
| 13 | |
"github.com/vbauerster/mpb/v7"
|
| 14 | |
"github.com/vbauerster/mpb/v7/decor"
|
|
13 |
"github.com/vbauerster/mpb/v8"
|
|
14 |
"github.com/vbauerster/mpb/v8/decor"
|
| 15 | 15 |
)
|
| 16 | 16 |
|
| 17 | 17 |
func TestBarCompleted(t *testing.T) {
|
| 0 | |
// Package decor provides common decorators for "github.com/vbauerster/mpb/v7" module.
|
|
0 |
// Package decor provides common decorators for "github.com/vbauerster/mpb/v8" module.
|
| 1 | 1 |
//
|
| 2 | 2 |
// Some decorators returned by this package might have a closure state. It is ok to use
|
| 3 | 3 |
// decorators concurrently, unless you share the same decorator among multiple
|
| 3 | 3 |
"fmt"
|
| 4 | 4 |
"strconv"
|
| 5 | 5 |
|
| 6 | |
"github.com/vbauerster/mpb/v7/internal"
|
|
6 |
"github.com/vbauerster/mpb/v8/internal"
|
| 7 | 7 |
)
|
| 8 | 8 |
|
| 9 | 9 |
type percentageType float64
|
| 3 | 3 |
"sync"
|
| 4 | 4 |
"testing"
|
| 5 | 5 |
|
| 6 | |
"github.com/vbauerster/mpb/v7"
|
| 7 | |
"github.com/vbauerster/mpb/v7/decor"
|
|
6 |
"github.com/vbauerster/mpb/v8"
|
|
7 |
"github.com/vbauerster/mpb/v8/decor"
|
| 8 | 8 |
)
|
| 9 | 9 |
|
| 10 | 10 |
func TestNameDecorator(t *testing.T) {
|
| 6 | 6 |
"math/rand"
|
| 7 | 7 |
"time"
|
| 8 | 8 |
|
| 9 | |
"github.com/vbauerster/mpb/v7"
|
| 10 | |
"github.com/vbauerster/mpb/v7/decor"
|
|
9 |
"github.com/vbauerster/mpb/v8"
|
|
10 |
"github.com/vbauerster/mpb/v8/decor"
|
| 11 | 11 |
)
|
| 12 | 12 |
|
| 13 | 13 |
func Example() {
|
| 0 | |
module github.com/vbauerster/mpb/v7
|
|
0 |
module github.com/vbauerster/mpb/v8
|
| 1 | 1 |
|
| 2 | 2 |
require (
|
| 3 | 3 |
github.com/VividCortex/ewma v1.2.0
|
| 6 | 6 |
"testing"
|
| 7 | 7 |
"time"
|
| 8 | 8 |
|
| 9 | |
"github.com/vbauerster/mpb/v7"
|
| 10 | |
"github.com/vbauerster/mpb/v7/decor"
|
|
9 |
"github.com/vbauerster/mpb/v8"
|
|
10 |
"github.com/vbauerster/mpb/v8/decor"
|
| 11 | 11 |
)
|
| 12 | 12 |
|
| 13 | 13 |
const (
|
| 6 | 6 |
"strings"
|
| 7 | 7 |
"testing"
|
| 8 | 8 |
|
| 9 | |
"github.com/vbauerster/mpb/v7"
|
|
9 |
"github.com/vbauerster/mpb/v8"
|
| 10 | 10 |
)
|
| 11 | 11 |
|
| 12 | 12 |
const content = `Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
|