progressbar alternatives and similar packages
Based on the "Advanced Console UIs" category.
Alternatively, view progressbar alternatives based on common mentions on social networks and blogs.
-
Rich Interactive Widgets for Terminal UIs
Terminal UI library with rich, interactive widgets — written in Golang -
tcell
Tcell is an alternate terminal package, similar in some ways to termbox, but better in others. -
pterm
✨ #PTerm is a modern Go module to easily beautify console output. Featuring charts, progressbars, tables, trees, text input, select menus and much more 🚀 It's completely configurable and 100% cross-platform compatible. -
asciigraph
Go package to make lightweight ASCII line graph ╭┈╯ in command line apps with no other dependencies. -
termtables
DISCONTINUED. A Go port of the Ruby library terminal-tables for simple ASCII table generation as well as providing markdown and HTML output -
yacspin
Yet Another CLi Spinner; providing over 80 easy to use and customizable terminal spinners for multiple OSes -
chalk
Intuitive package for prettifying terminal/console output. http://godoc.org/github.com/ttacon/chalk -
GCli
🖥 Go CLI application, tool library, running CLI commands, support console color, user interaction, progress display, data formatting display, generate bash/zsh completion add more features. Go的命令行应用,工具库,运行CLI命令,支持命令行色彩,用户交互,进度显示,数据格式化显示,生成bash/zsh命令补全脚本 -
ctc
Console Text Colors - The non-invasive cross-platform terminal color library does not need to modify the Print method -
crab-config-files-templating
Dynamic configuration file templating tool for kubernetes manifest or general configuration files
InfluxDB - Purpose built for real-time analytics at any scale.
Do you think we are missing an alternative of progressbar or a related project?
README
progressbar
A very simple thread-safe progress bar which should work on every OS without problems. I needed a progressbar for croc and everything I tried had problems, so I made another one. In order to be OS agnostic I do not plan to support multi-line outputs.
Install
go get -u github.com/schollz/progressbar/v3
Usage
Basic usage
bar := progressbar.Default(100)
for i := 0; i < 100; i++ {
bar.Add(1)
time.Sleep(40 * time.Millisecond)
}
which looks like:
[Example of basic bar](examples/basic/basic.gif)
I/O operations
The progressbar
implements an io.Writer
so it can automatically detect the number of bytes written to a stream, so you can use it as a progressbar for an io.Reader
.
req, _ := http.NewRequest("GET", "https://dl.google.com/go/go1.14.2.src.tar.gz", nil)
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
f, _ := os.OpenFile("go1.14.2.src.tar.gz", os.O_CREATE|os.O_WRONLY, 0644)
defer f.Close()
bar := progressbar.DefaultBytes(
resp.ContentLength,
"downloading",
)
io.Copy(io.MultiWriter(f, bar), resp.Body)
which looks like:
[Example of download bar](examples/download/download.gif)
Progress bar with unknown length
A progressbar with unknown length is a spinner. Any bar with -1 length will automatically convert it to a spinner with a customizable spinner type. For example, the above code can be run and set the resp.ContentLength
to -1
.
which looks like:
[Example of download bar with unknown length](examples/download-unknown/download-unknown.gif)
Customization
There is a lot of customization that you can do - change the writer, the color, the width, description, theme, etc. See all the options.
bar := progressbar.NewOptions(1000,
progressbar.OptionSetWriter(ansi.NewAnsiStdout()),
progressbar.OptionEnableColorCodes(true),
progressbar.OptionShowBytes(true),
progressbar.OptionSetWidth(15),
progressbar.OptionSetDescription("[cyan][1/3][reset] Writing moshable file..."),
progressbar.OptionSetTheme(progressbar.Theme{
Saucer: "[green]=[reset]",
SaucerHead: "[green]>[reset]",
SaucerPadding: " ",
BarStart: "[",
BarEnd: "]",
}))
for i := 0; i < 1000; i++ {
bar.Add(1)
time.Sleep(5 * time.Millisecond)
}
which looks like:
[Example of customized bar](examples/customization/customization.gif)
Contributing
Pull requests are welcome. Feel free to...
- Revise documentation
- Add new features
- Fix bugs
- Suggest improvements
Thanks
Thanks @Dynom for massive improvements in version 2.0!
Thanks @CrushedPixel for adding descriptions and color code support!
Thanks @MrMe42 for adding some minor features!
Thanks @tehstun for some great PRs!
Thanks @Benzammour and @haseth for helping create v3!
Thanks @briandowns for compiling the list of spinners.
License
MIT
*Note that all licence references and agreements mentioned in the progressbar README section above
are relevant to that project's source code only.