Spinny is a tiny terminal spinner package for Nim Programming Language.
You can use Nimble to install the package by running:
nimble install spinny
Feel free to take the example code to test out the package!
Spinny is quite easy to use. You can set an already running Spinny
's symbol, color, or even the text!
import spinny, colorize, os
var spinner1 = newSpinny("Loading file..".fgWhite, "dots")
spinner1.setSymbolColor(colorize.fgBlue)
spinner1.start()
# do some work here
for x in countup(5, 10):
sleep(500)
spinner1.success("File was loaded successfully.")
var spinner2 = newSpinny("Downloading files..".fgBlue, "dots5")
spinner2.setSymbolColor(colorize.fgLightBlue)
spinner2.start()
# do some work here
for x in countup(5, 10):
sleep(500)
spinner2.error("Sorry, something went wrong during downloading!")
Spinny uses the colorize library for terminal colors. For spinners to use, take a look at the spinners JSON file. (Credit goes to sindresorhus)
The following procs are available on a Spinny
object:
setSymbolColor*(spinny: Spinny, color: proc(x: string): string)
setSymbol*(spinny: Spinny, newSymbol: string)
setText*(spinny: Spinny, newSymbol: string)
start*(spinny: Spinny)
stop*(spinny: Spinny)
success*(spinny: Spinny, msg: string)
error*(spinny: Spinny, msg: string)
All contributions are welcome. Feel free to make this project better. :)
- Mark Molnar
- MIT