-
Notifications
You must be signed in to change notification settings - Fork 1
/
bar.go
32 lines (29 loc) · 766 Bytes
/
bar.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package osmpbfparser
import (
"github.com/vbauerster/mpb/v5"
"github.com/vbauerster/mpb/v5/decor"
"sync"
)
// newProgress return new mpb progress with input total.
func newProgress(n int) (*mpb.Progress, *sync.WaitGroup) {
var wg sync.WaitGroup
wg.Add(n)
return mpb.New(mpb.WithWaitGroup(&wg), mpb.WithWidth(100)), &wg
}
func addBar(pb *mpb.Progress, name string, total int) *mpb.Bar {
return pb.AddBar(
int64(total),
mpb.BarStyle("╢▌▌░╟"),
mpb.PrependDecorators(
decor.Name(name, decor.WC{W: 20, C: decor.DidentRight}),
),
mpb.AppendDecorators(
decor.CountersNoUnit("%d/%d ", decor.WCSyncWidth),
decor.OnComplete(
decor.AverageETA(decor.ET_STYLE_GO, decor.WCSyncSpaceR),
"done",
),
decor.Percentage(),
),
)
}