A spinner (aka loading animation) for terminal in Go

adhocore
/
chin

A GO lang library to show a spinner as user waits for any long running jobs to finish.

adhocore/chin

A GO lang command line tool to show a spi…


This content originally appeared on DEV Community 👩‍💻👨‍💻 and was authored by Jitendra

GitHub logo adhocore / chin

A GO lang library to show a spinner as user waits for any long running jobs to finish.

adhocore/chin

Go Report Lint Donate 15 Donate 25 Donate 50 Tweet

A GO lang 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 example for more (there is also one without waitgroup).

To run the examples: go run examples/main.go

Screen

CHIN

Other projects

My other golang projects you might find interesting and useful:

  • gronx - Lightweight, fast and dependency-free Cron expression parser (due checker), task scheduler and/or daemon for Golang (tested on v1.13 and…

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

CHIN

Feedback?

Just drop a comment here, or open issues/PR in the repo. Thanks. 😎


This content originally appeared on DEV Community 👩‍💻👨‍💻 and was authored by Jitendra


Print Share Comment Cite Upload Translate Updates
APA

Jitendra | Sciencx (2022-10-26T14:24:00+00:00) A spinner (aka loading animation) for terminal in Go. Retrieved from https://www.scien.cx/2022/10/26/a-spinner-aka-loading-animation-for-terminal-in-go/

MLA
" » A spinner (aka loading animation) for terminal in Go." Jitendra | Sciencx - Wednesday October 26, 2022, https://www.scien.cx/2022/10/26/a-spinner-aka-loading-animation-for-terminal-in-go/
HARVARD
Jitendra | Sciencx Wednesday October 26, 2022 » A spinner (aka loading animation) for terminal in Go., viewed ,<https://www.scien.cx/2022/10/26/a-spinner-aka-loading-animation-for-terminal-in-go/>
VANCOUVER
Jitendra | Sciencx - » A spinner (aka loading animation) for terminal in Go. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2022/10/26/a-spinner-aka-loading-animation-for-terminal-in-go/
CHICAGO
" » A spinner (aka loading animation) for terminal in Go." Jitendra | Sciencx - Accessed . https://www.scien.cx/2022/10/26/a-spinner-aka-loading-animation-for-terminal-in-go/
IEEE
" » A spinner (aka loading animation) for terminal in Go." Jitendra | Sciencx [Online]. Available: https://www.scien.cx/2022/10/26/a-spinner-aka-loading-animation-for-terminal-in-go/. [Accessed: ]
rf:citation
» A spinner (aka loading animation) for terminal in Go | Jitendra | Sciencx | https://www.scien.cx/2022/10/26/a-spinner-aka-loading-animation-for-terminal-in-go/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.