cheggaaa/pb golang 进度条包

cheggaaa/pb 是一个灵活的golang 进度条工具包,使用简单,支持的功能也比较多,配置行也比较灵活

参考使用

  • 代码
package main
import (
    "time"
    "github.com/cheggaaa/pb/v3"
)
func main() {
    count := 100000
    // create and start new bar
    bar := pb.StartNew(count)
    // start bar from 'default' template
    // bar := pb.Default.Start(count)
    // start bar from 'simple' template
    // bar := pb.Simple.Start(count)
    // start bar from 'full' template
    // bar := pb.Full.Start(count)
    for i := 0; i < count; i++ {
        bar.Increment()
        time.Sleep(time.Millisecond)
    }
    bar.Finish()
}

参考资料

https://github.com/cheggaaa/pb

posted on 2020-11-09 17:31  荣锋亮  阅读(477)  评论(0编辑  收藏  举报

导航