https://github.com/liamg/loading
A collection of highly customisable loading bars for Go CLI apps.
https://github.com/liamg/loading
Last synced: 8 months ago
JSON representation
A collection of highly customisable loading bars for Go CLI apps.
- Host: GitHub
- URL: https://github.com/liamg/loading
- Owner: liamg
- License: mit
- Created: 2022-06-29T19:12:19.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-08-06T10:46:03.000Z (over 1 year ago)
- Last Synced: 2025-05-12T06:57:53.894Z (8 months ago)
- Language: Go
- Homepage:
- Size: 365 KB
- Stars: 37
- Watchers: 3
- Forks: 5
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ⏳ loading
A collection of highly customisable loading bars for Go CLI apps.

## Basic Usage
```go
package main
import (
"github.com/liamg/loading/pkg/bar"
"time"
)
func main() {
// create a bar
loadingBar := bar.New()
// set the total to 100
loadingBar.SetTotal(100)
// increment the bar to 100 over 10 seconds
for i := 0; i <= 100; i++ {
time.Sleep(time.Millisecond * 100)
loadingBar.SetCurrent(i)
}
}
```
See the [examples](https://github.com/liamg/loading/tree/main/_examples) or the gallery below for more inspiration.
## Bar Anatomy

1. The label, set with `bar.OptionWithLabel("my label")`.
2. The graphical component, set with `bar.OptionWithRenderFunc(bar.RenderRainbow)`
3. The statistics component, set with `bar.OptionWithStatsFuncs(bar.StatsTimeRemaining)`
## Example Gallery
