Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mbrlabs/clispin
Wrap your functions in fancy cli spinners
https://github.com/mbrlabs/clispin
cli go golang loading progress spinner statusbar terminal
Last synced: about 2 months ago
JSON representation
Wrap your functions in fancy cli spinners
- Host: GitHub
- URL: https://github.com/mbrlabs/clispin
- Owner: mbrlabs
- License: mit
- Created: 2017-04-20T18:01:03.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-04-23T20:44:49.000Z (over 7 years ago)
- Last Synced: 2024-06-20T11:08:16.375Z (7 months ago)
- Topics: cli, go, golang, loading, progress, spinner, statusbar, terminal
- Language: Go
- Size: 35.2 KB
- Stars: 5
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# clispin
Clispin is a Go library, that makes it ridiculously easy to integrate fancy unicode spinners in your app.## Usage
```go
spinner := clispin.New(nil)
spinner.Start(func() {
// Do your work here. Update spinner text with Print or Printf
spinner.Printf("Downloading file %d/2", 1)
time.Sleep(time.Second)
spinner.Printf("Downloading file %d/2", 2)
time.Sleep(time.Second)spinner.Print("Processing files")
time.Sleep(time.Second)
spinner.Print("Done")
})
``````clispin.New()``` creates a new spinner. You can pass in a ```Sprite``` struct to customize the spinner
animation. If no sprite is provided, a default one is chosen.There are also a couple of [sprites](https://github.com/mbrlabs/clispin/blob/master/sprite.go) included in this library.