Home

Awesome

adhocore/chin

Go Report Lint Tweet Support

<!-- [![Donate 15](https://img.shields.io/badge/donate-paypal-blue.svg?style=flat-square&label=donate+15)](https://www.paypal.me/ji10/15usd) [![Donate 25](https://img.shields.io/badge/donate-paypal-blue.svg?style=flat-square&label=donate+25)](https://www.paypal.me/ji10/25usd) [![Donate 50](https://img.shields.io/badge/donate-paypal-blue.svg?style=flat-square&label=donate+50)](https://www.paypal.me/ji10/50usd) -->

A Golang command line tool to show a spinner as you wait for some long running jobs to finish.

This is a simple project but carries a tremendous value to me [❤️].

Usage

Install chin:

go get -u github.com/adhocore/chin

Use in Go code with WaitGroup:

var wg sync.WaitGroup

s := chin.New().WithWait(&wg)
go s.Start()

// invoke some long running task
// (you can also call s.Stop() from that task)
longTask(&wg)

s.Stop()
wg.Wait()

Refer and run working examples with: go run examples/main.go

Custom Spinner

You can choose from provided spinner sets chin.Default, chin.Arrows and chin.Dots:

s := chin.New(chin.Arrows)
// or
s := chin.New(chin.Dots)

go s.Start()

chin.Default is selected by default so you don't have to specify it.

You can also define your own spinner set with delay and animation chars like so:

// Animates 0 to 4 in a gap of 50ms:
s := chin.New(chin.Set{50*time.Millisecond, []string{"0", "1", "2", "3", "4", "3", "2", "1"}})
go s.Start()

Screen

CHIN


Other projects

My other golang projects you might find interesting and useful: