https://github.com/slok/gospinner
Make beautiful and fast spinners in Go
https://github.com/slok/gospinner
Last synced: 7 months ago
JSON representation
Make beautiful and fast spinners in Go
- Host: GitHub
- URL: https://github.com/slok/gospinner
- Owner: slok
- License: mit
- Created: 2016-08-16T18:30:18.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2018-06-19T18:35:28.000Z (over 7 years ago)
- Last Synced: 2025-03-19T08:39:25.164Z (7 months ago)
- Language: Go
- Size: 2.32 MB
- Stars: 17
- Watchers: 3
- Forks: 3
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Gospinner [](http://godoc.org/github.com/slok/gospinner) [](https://travis-ci.org/slok/gospinner)
Gospinner lets you make simple spinners for your go cli applications. Is fast
and easy to use. Simple customizations and ready to go defaults!
## Install
```
go get github.com/slok/gospinner
```## Running examples
* [Example 0](https://asciinema.org/a/82944)
* [Example 1](https://asciinema.org/a/82946)
* [Example 2](https://asciinema.org/a/82963)## Examples
### Default spinner
```go
s, _ := gospinner.NewSpinner(gospinner.Dots)
s.Start("Loading")
// Do stuff
s.Finish()
```### Custom color spinner
```go
s, _ := gospinner.NewSpinnerWithColor(gospinner.Ball, gospinner.FgGreen)
s.Start("Loading")
// Do stuff
s.Finish()
```### No color spinner
```go
s, _ := s, _ := gospinner.NewSpinnerNoColor(gospinner.GrowHorizontal)
s.Start("Loading")
// Do stuff
s.Finish()
```### Spinner with finishers
```go
s, _ := gospinner.NewSpinner(gospinner.Pong)s.Start("Loading job 1")
// Do job 1 ...
s.Succeed()s.Start("Loading job 2")
// Do job 2 ...
s.Fail()s.Start("Loading job 3")
// Do job 3 ...
s.Warn()
```### Changing message while spinning and finishing with custom message
```go
s, _ := gospinner.NewSpinner(gospinner.Square)
s.Start("Loading")
// Do stuff
s.SetMessage("Starting server dependencies")
// Do more stuff
s.SetMessage("Starting server")
// Do more stuff
s.FinishWithMessage("⚔", "Finished!")
```### Available spinners:
* Ball
* Column
* Slash
* Square
* Triangle
* Dots
* Dots2
* Pipe
* SimpleDots
* SimpleDotsScrolling
* GrowVertical
* GrowHorizontal
* Arrow
* BouncingBar
* BouncingBall
* Pong
* ProgressBarFor more customizations you should check the [documentation](https://godoc.org/github.com/slok/gospinner)
## Credits
[Xabier Larrakoetxea](http://github.com/slok)
## License
The MIT License (MIT) - see [`LICENSE.md`](LICENSE.md) for more details