Skip to content

slok/gospinner

Repository files navigation

Gospinner GoDoc Build Status

Gospinner lets you make simple spinners for your go cli applications. Is fast and easy to use. Simple customizations and ready to go defaults!

gospinner

Install

go get github.com/slok/gospinner

Running examples

Examples

Default spinner

s, _ := gospinner.NewSpinner(gospinner.Dots)
s.Start("Loading")
// Do stuff
s.Finish()

Custom color spinner

s, _ := gospinner.NewSpinnerWithColor(gospinner.Ball, gospinner.FgGreen)
s.Start("Loading")
// Do stuff
s.Finish()

No color spinner

s, _ := s, _ := gospinner.NewSpinnerNoColor(gospinner.GrowHorizontal)
s.Start("Loading")
// Do stuff
s.Finish()

Spinner with finishers

s, _ := gospinner.NewSpinner(gospinner.Pong)

s.Start("Loading job 1")
// Do job 1 ...
s.Succeed()

s.Start("Loading job 2")
// Do job 2 ...
s.Fail()

s.Start("Loading job 3")
// Do job 3 ...
s.Warn()

Changing message while spinning and finishing with custom message

s, _ := gospinner.NewSpinner(gospinner.Square)
s.Start("Loading")
// Do stuff
s.SetMessage("Starting server dependencies")
// Do more stuff
s.SetMessage("Starting server")
// Do more stuff
s.FinishWithMessage("⚔", "Finished!")

Available spinners:

  • Ball
  • Column
  • Slash
  • Square
  • Triangle
  • Dots
  • Dots2
  • Pipe
  • SimpleDots
  • SimpleDotsScrolling
  • GrowVertical
  • GrowHorizontal
  • Arrow
  • BouncingBar
  • BouncingBall
  • Pong
  • ProgressBar

For more customizations you should check the documentation

Credits

Xabier Larrakoetxea

License

The MIT License (MIT) - see LICENSE.md for more details

About

Make beautiful and fast spinners in Go

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages