企业🤖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] ```