termspinner
spinner
A simple terminal spinner written in crystal
Installation
-
Add the dependency to your
shard.yml
:dependencies: termspinner: github: eliobr/termspinner
-
Run
shards install
Usage
require "termspinner"
spi = Spinner::Spinner.new("Waiting...")
begin
spi.start()
response = HTTP::Client.get("https://cataas.com/cat/gif")
if response.status_code == 200
spi.success("Success")
else
spi.error("Failed")
end
rescue
spi.error("Error while trying to connect")
end
spi.start("Doing something useful...")
sleep(2.seconds)
spi.message= "The process is taking longer than expected..."
sleep(3)
spi.error("Failed to do something useful")
spi.start("Doing something...")
sleep(2.seconds)
spi.stop("⚠️ Some custom message".colorize(:yellow).to_s)
Contributing
- Fork it (https://github.com/eliobr/termspinner/fork)
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
Contributors
- elio - creator and maintainer