bump major version to v7
Vladimir Bauer
5 years ago
| 11 | 11 | |
| 12 | 12 | "github.com/acarl005/stripansi" |
| 13 | 13 | "github.com/mattn/go-runewidth" |
| 14 | "github.com/vbauerster/mpb/v6/decor" | |
| 14 | "github.com/vbauerster/mpb/v7/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/v6/decor" | |
| 5 | "github.com/vbauerster/mpb/v7/decor" | |
| 6 | 6 | ) |
| 7 | 7 | |
| 8 | 8 | // BarFiller interface. |
| 5 | 5 | |
| 6 | 6 | "github.com/acarl005/stripansi" |
| 7 | 7 | "github.com/mattn/go-runewidth" |
| 8 | "github.com/vbauerster/mpb/v6/decor" | |
| 9 | "github.com/vbauerster/mpb/v6/internal" | |
| 8 | "github.com/vbauerster/mpb/v7/decor" | |
| 9 | "github.com/vbauerster/mpb/v7/internal" | |
| 10 | 10 | ) |
| 11 | 11 | |
| 12 | 12 | const ( |
| 5 | 5 | |
| 6 | 6 | "github.com/acarl005/stripansi" |
| 7 | 7 | "github.com/mattn/go-runewidth" |
| 8 | "github.com/vbauerster/mpb/v6/decor" | |
| 9 | "github.com/vbauerster/mpb/v6/internal" | |
| 8 | "github.com/vbauerster/mpb/v7/decor" | |
| 9 | "github.com/vbauerster/mpb/v7/internal" | |
| 10 | 10 | ) |
| 11 | 11 | |
| 12 | 12 | const ( |
| 3 | 3 | "bytes" |
| 4 | 4 | "io" |
| 5 | 5 | |
| 6 | "github.com/vbauerster/mpb/v6/decor" | |
| 7 | "github.com/vbauerster/mpb/v6/internal" | |
| 6 | "github.com/vbauerster/mpb/v7/decor" | |
| 7 | "github.com/vbauerster/mpb/v7/internal" | |
| 8 | 8 | ) |
| 9 | 9 | |
| 10 | 10 | // BarOption is a func option to alter default behavior of a bar. |
| 9 | 9 | "time" |
| 10 | 10 | "unicode/utf8" |
| 11 | 11 | |
| 12 | "github.com/vbauerster/mpb/v6" | |
| 13 | "github.com/vbauerster/mpb/v6/decor" | |
| 12 | "github.com/vbauerster/mpb/v7" | |
| 13 | "github.com/vbauerster/mpb/v7/decor" | |
| 14 | 14 | ) |
| 15 | 15 | |
| 16 | 16 | func TestBarCompleted(t *testing.T) { |
| 3 | 3 | "io/ioutil" |
| 4 | 4 | "testing" |
| 5 | 5 | |
| 6 | "github.com/vbauerster/mpb/v6/decor" | |
| 6 | "github.com/vbauerster/mpb/v7/decor" | |
| 7 | 7 | ) |
| 8 | 8 | |
| 9 | 9 | func BenchmarkIncrSingleBar(b *testing.B) { |
| 5 | 5 | "sync" |
| 6 | 6 | "time" |
| 7 | 7 | |
| 8 | "github.com/vbauerster/mpb/v6/internal" | |
| 8 | "github.com/vbauerster/mpb/v7/internal" | |
| 9 | 9 | ) |
| 10 | 10 | |
| 11 | 11 | // ContainerOption is a func option to alter default behavior of a bar |
| 0 | // Package decor provides common decorators for "github.com/vbauerster/mpb/v6" module. | |
| 1 | /* | |
| 2 | Some decorators returned by this package might have a closure state. It is ok to use | |
| 3 | decorators concurrently, unless you share the same decorator among multiple | |
| 4 | *mpb.Bar instances. To avoid data races, create new decorator per *mpb.Bar instance. | |
| 5 | ||
| 6 | Don't: | |
| 7 | ||
| 8 | p := mpb.New() | |
| 9 | name := decor.Name("bar") | |
| 10 | p.AddBar(100, mpb.AppendDecorators(name)) | |
| 11 | p.AddBar(100, mpb.AppendDecorators(name)) | |
| 12 | ||
| 13 | Do: | |
| 14 | ||
| 15 | p := mpb.New() | |
| 16 | p.AddBar(100, mpb.AppendDecorators(decor.Name("bar1"))) | |
| 17 | p.AddBar(100, mpb.AppendDecorators(decor.Name("bar2"))) | |
| 18 | */ | |
| 0 | // Package decor provides common decorators for "github.com/vbauerster/mpb/v7" module. | |
| 1 | // | |
| 2 | // Some decorators returned by this package might have a closure state. It is ok to use | |
| 3 | // decorators concurrently, unless you share the same decorator among multiple | |
| 4 | // *mpb.Bar instances. To avoid data races, create new decorator per *mpb.Bar instance. | |
| 5 | // | |
| 6 | // Don't: | |
| 7 | // | |
| 8 | // p := mpb.New() | |
| 9 | // name := decor.Name("bar") | |
| 10 | // p.AddBar(100, mpb.AppendDecorators(name)) | |
| 11 | // p.AddBar(100, mpb.AppendDecorators(name)) | |
| 12 | // | |
| 13 | // Do: | |
| 14 | // | |
| 15 | // p := mpb.New() | |
| 16 | // p.AddBar(100, mpb.AppendDecorators(decor.Name("bar1"))) | |
| 17 | // p.AddBar(100, mpb.AppendDecorators(decor.Name("bar2"))) | |
| 19 | 18 | package decor |
| 4 | 4 | "io" |
| 5 | 5 | "strconv" |
| 6 | 6 | |
| 7 | "github.com/vbauerster/mpb/v6/internal" | |
| 7 | "github.com/vbauerster/mpb/v7/internal" | |
| 8 | 8 | ) |
| 9 | 9 | |
| 10 | 10 | type percentageType float64 |
| 3 | 3 | "sync" |
| 4 | 4 | "testing" |
| 5 | 5 | |
| 6 | "github.com/vbauerster/mpb/v6" | |
| 7 | "github.com/vbauerster/mpb/v6/decor" | |
| 6 | "github.com/vbauerster/mpb/v7" | |
| 7 | "github.com/vbauerster/mpb/v7/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/v6" | |
| 10 | "github.com/vbauerster/mpb/v6/decor" | |
| 9 | "github.com/vbauerster/mpb/v7" | |
| 10 | "github.com/vbauerster/mpb/v7/decor" | |
| 11 | 11 | ) |
| 12 | 12 | |
| 13 | 13 | func Example() { |
| 0 | module github.com/vbauerster/mpb/v6 | |
| 0 | module github.com/vbauerster/mpb/v7 | |
| 1 | 1 | |
| 2 | 2 | require ( |
| 3 | 3 | github.com/VividCortex/ewma v1.2.0 |
| 4 | 4 | github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d |
| 5 | github.com/mattn/go-runewidth v0.0.12 | |
| 6 | github.com/rivo/uniseg v0.2.0 | |
| 7 | golang.org/x/sys v0.0.0-20210514084401-e8d321eab015 | |
| 5 | github.com/mattn/go-runewidth v0.0.13 | |
| 6 | golang.org/x/sys v0.0.0-20210521203332-0cec03c779c1 | |
| 8 | 7 | ) |
| 9 | 8 | |
| 10 | 9 | go 1.14 |
| 1 | 1 | github.com/VividCortex/ewma v1.2.0/go.mod h1:nz4BbCtbLyFDeC9SUHbtcT5644juEuWfUAUnGx7j5l4= |
| 2 | 2 | github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d h1:licZJFw2RwpHMqeKTCYkitsPqHNxTmd4SNR5r94FGM8= |
| 3 | 3 | github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d/go.mod h1:asat636LX7Bqt5lYEZ27JNDcqxfjdBQuJ/MM4CN/Lzo= |
| 4 | github.com/mattn/go-runewidth v0.0.12 h1:Y41i/hVW3Pgwr8gV+J23B9YEY0zxjptBuCWEaxmAOow= | |
| 5 | github.com/mattn/go-runewidth v0.0.12/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk= | |
| 6 | github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= | |
| 4 | github.com/mattn/go-runewidth v0.0.13 h1:lTGmDsbAYt5DmK6OnoV7EuIF1wEIFAcxld6ypU4OSgU= | |
| 5 | github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= | |
| 7 | 6 | github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= |
| 8 | 7 | github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= |
| 9 | golang.org/x/sys v0.0.0-20210514084401-e8d321eab015 h1:hZR0X1kPW+nwyJ9xRxqZk1vx5RUObAPBdKVvXPDUH/E= | |
| 10 | golang.org/x/sys v0.0.0-20210514084401-e8d321eab015/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= | |
| 8 | golang.org/x/sys v0.0.0-20210521203332-0cec03c779c1 h1:lCnv+lfrU9FRPGf8NeRuWAAPjNnema5WtBinMgs1fD8= | |
| 9 | golang.org/x/sys v0.0.0-20210521203332-0cec03c779c1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= |
| 12 | 12 | "sync" |
| 13 | 13 | "time" |
| 14 | 14 | |
| 15 | "github.com/vbauerster/mpb/v6/cwriter" | |
| 16 | "github.com/vbauerster/mpb/v6/decor" | |
| 15 | "github.com/vbauerster/mpb/v7/cwriter" | |
| 16 | "github.com/vbauerster/mpb/v7/decor" | |
| 17 | 17 | ) |
| 18 | 18 | |
| 19 | 19 | const ( |