https://github.com/nu11ptr/cmpb
A color multi-progress bar for Go terminal applications
https://github.com/nu11ptr/cmpb
cli color go golang progress-bar progressbar terminal
Last synced: 5 months ago
JSON representation
A color multi-progress bar for Go terminal applications
- Host: GitHub
- URL: https://github.com/nu11ptr/cmpb
- Owner: nu11ptr
- License: mit
- Created: 2018-09-23T13:18:59.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-10-13T13:15:35.000Z (over 7 years ago)
- Last Synced: 2025-08-14T01:48:40.774Z (11 months ago)
- Topics: cli, color, go, golang, progress-bar, progressbar, terminal
- Language: Go
- Homepage:
- Size: 1.48 MB
- Stars: 8
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# cmpb
[](https://travis-ci.org/nu11ptr/cmpb)
[](https://ci.appveyor.com/project/nu11ptr/cmpb/branch/master)
[](https://coveralls.io/github/nu11ptr/cmpb?branch=master)
[](https://codeclimate.com/github/nu11ptr/cmpb/maintainability)
[](https://goreportcard.com/report/github.com/nu11ptr/cmpb)
[](https://godoc.org/github.com/nu11ptr/cmpb)
A color multi-progress bar for Go terminal applications. Works on ANSI compatible terminals... and also on Windows!
# Demo

# Demo Source
```go
package main
import (
"math/rand"
"time"
"github.com/fatih/color"
"github.com/nu11ptr/cmpb"
)
const total = 100
var (
keys = []string{"server1000", "server1001", "server1002"}
actions = []string{"downloading...", "compiling source...", "fetching...", "committing work..."}
)
func main() {
p := cmpb.New()
colors := new(cmpb.BarColors)
colors.Post, colors.KeyDiv, colors.LBracket, colors.RBracket =
color.HiCyanString, color.HiCyanString, color.HiCyanString, color.HiCyanString
colors.Key = color.HiBlueString
colors.Msg, colors.Empty = color.HiYellowString, color.HiYellowString
colors.Full = color.HiGreenString
colors.Curr = color.GreenString
colors.PreBar, colors.PostBar = color.HiMagentaString, color.HiMagentaString
for _, key := range keys {
b := p.NewBar(key, total)
go func() {
for i := 0; i < total; i++ {
time.Sleep(time.Duration(rand.Intn(250)) * time.Millisecond)
action := actions[rand.Intn(len(actions))]
b.SetMessage(action)
b.Increment()
}
}()
}
p.SetColors(colors)
p.Start()
p.Wait()
}
```