Skip to content
The custom loader for your CLI Application. Written in Golang.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
examples
README.md
loading.go
loading_test.go

README.md

Go-Loading

Go-Loading, or more likely loading is your custom loader in your every CLI application.

CircleCI

Installation:

Get it by using: go get -u github.com/whaangbuu/loading

How does it work?

It adds a loader in your CLI Application.

See clip below:

asciicast

NOTE:

go-imgur-cli is my sample CLI application that uploads images to imgur

How to use?

Simply create a new loading instance.

loading := loading.StartNew("<some_title>")

Changing colors of the loader:

For now, the allowed colors are: red, green, blue, and white.

loading.SetColor("green")

Changing the default loaders:

loading.SetLoaders([]string{"", "", "", "", "", "", "", ""})

Stopping the loader:

loading.Stop()

Stopping the loader with a specific time.

time.Sleep(3 * time.Second)
loading.Stop()

This stops the loader after 3 seconds.

Stopping the loader while waiting for a task.

// some productive task here.
loading.Stop()

See /examples directory for more concise guide.

Testing:

See loading_test.go

TODO:

  • Improve tests
  • Write more test
You can’t perform that action at this time.