ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
[TOC] > [schollz/progressbar](https://github.com/schollz/progressbar) ## 安装 `go get -u github.com/schollz/progressbar/v2` ## 实例 ### 基础 ``` bar := progressbar.New(100) for i := 0; i < 100; i++ { bar.Add(1) time.Sleep(10 * time.Millisecond) } ``` ``` 100% |████████████████████████████████████████| [1s:0s] ``` ### 使用自定义样式 ``` bar := NewOptions( 10, OptionSetTheme(Theme{Saucer: "#", SaucerPadding: "-", BarStart: ">", BarEnd: "<"}), OptionSetWidth(10), OptionSetWriter(&buf), ) bar.Add(5) result := strings.TrimSpace(buf.String()) ```` ``` 50% >#####-----< [0s:0s] ```