adhocore / chin
A Go lang library to show a spinner as user waits for any long running jobs to finish.
adhocore/chin
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…
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 example for more (there is also one without waitgroup).
Screen
Feedback?
Just drop a comment here, or open issues/PR in the repo. Thanks. 😎
Top comments (0)