tcping add progressbar

This commit is contained in:
mazhuang
2021-11-10 12:25:10 +08:00
parent 71671ebe66
commit 4d64abb94d
7 changed files with 237 additions and 148 deletions

View File

@@ -11,13 +11,21 @@ const (
)
type Bar struct {
*pb.ProgressBar
pb *pb.ProgressBar
}
func NewBar(count int) *Bar {
return &Bar{pb.Simple.Start(count)}
}
func (b *Bar) Grow(num int) {
b.pb.Add(num)
}
func (b *Bar) Done() {
b.pb.Finish()
}
func handleProgressGenerator(pb *pb.ProgressBar) func(e ProgressEvent) {
return func(e ProgressEvent) {
switch e {