https://github.com/alecrabbit/go-cli-spinner
Colorful configurable spinner for go cli applications
https://github.com/alecrabbit/go-cli-spinner
ansi colorful go golang spinner spinners
Last synced: 4 months ago
JSON representation
Colorful configurable spinner for go cli applications
- Host: GitHub
- URL: https://github.com/alecrabbit/go-cli-spinner
- Owner: alecrabbit
- License: mit
- Created: 2019-09-20T15:06:26.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-07-13T14:40:06.000Z (almost 5 years ago)
- Last Synced: 2025-01-08T19:11:46.211Z (5 months ago)
- Topics: ansi, colorful, go, golang, spinner, spinners
- Language: Go
- Homepage:
- Size: 238 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# 🏵️ Go Console Spinner
## UPD. development frozen
~~```*** COMING SOON ***```~~[](https://travis-ci.com/alecrabbit/go-cli-spinner)
[](https://goreportcard.com/report/github.com/alecrabbit/go-cli-spinner)
[](https://coveralls.io/github/alecrabbit/go-cli-spinner?branch=master)
> API may be a subject to change
### Features
- highly configurable ([options](docs/options.md))
- progress indication during spin `spinner.Progress(0.5)` ➙ `50%`
- messages during spin `spinner.Message("message")`
- configurable elements order - chars, messages and progress
- separated format settings for chars, messages and progress
- hides cursor on `spinner.Start()`, shows on `spinner.Stop()`
- cursor hide can be disabled `spinner.HideCursor(false)`
- has `Erase()` method
- has `Current()` method to write current frame again for smooth animation
- final message
- supports pipe `|` and redirect `>` output- [ ] separated color settings for chars, messages and progress
- [ ] has `Disable()` and `Enable()` methods (questionable)It's a proof of concept and kinda port of [alecrabbit/php-console-spinner](https://github.com/alecrabbit/php-console-spinner)
For now you can try it **as is** and shape it's development if you wish
> Xterm terminal(package uses ANSI codes)
> Works on Windows too! Thanks to [mattn/go-colorable](https://github.com/mattn/go-colorable)
### [Examples](https://github.com/alecrabbit/go-cli-spinner/tree/master/examples/)
### Quickstart
```go
package mainimport (
"time""github.com/alecrabbit/go-cli-spinner"
)func main() {
s, _ := spinner.New()
// Start spinner
s.Start()
// Doing some work
time.Sleep(3 * time.Second)
// Set current message
s.Message("Current message")
// Set current progress
s.Progress(0.511)
// Doing some work
time.Sleep(3 * time.Second)
// Stop spinner
s.Stop()
}
```### [Usage](docs/usage.md)