2015-12-30 11:55:14 +00:00
|
|
|
|
# Spinner
|
2015-12-28 07:54:44 +00:00
|
|
|
|
|
2015-12-30 11:55:14 +00:00
|
|
|
|
Terminal Spinner for Crystal Programming Language
|
2015-12-28 07:54:44 +00:00
|
|
|
|
|
2015-12-30 11:55:14 +00:00
|
|
|
|
![All](/images/all.gif)
|
2015-12-28 07:54:44 +00:00
|
|
|
|
|
2015-12-30 11:55:14 +00:00
|
|
|
|
## Installation
|
2015-12-28 07:54:44 +00:00
|
|
|
|
|
|
|
|
|
Add this to your application's `shard.yml`:
|
|
|
|
|
|
|
|
|
|
```yaml
|
|
|
|
|
dependencies:
|
|
|
|
|
spinner:
|
|
|
|
|
github: askn/spinner
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```crystal
|
|
|
|
|
require "spinner"
|
|
|
|
|
|
2015-12-30 11:55:14 +00:00
|
|
|
|
sp = Spin.new
|
|
|
|
|
sp.start
|
|
|
|
|
sleep 3
|
|
|
|
|
sp.stop
|
|
|
|
|
```
|
2015-12-28 07:54:44 +00:00
|
|
|
|
|
2015-12-30 11:55:14 +00:00
|
|
|
|
## Options
|
2015-12-28 07:54:44 +00:00
|
|
|
|
|
2015-12-30 11:55:14 +00:00
|
|
|
|
`delay`: `default = 0.1`
|
2015-12-28 07:54:44 +00:00
|
|
|
|
|
2015-12-30 14:21:42 +00:00
|
|
|
|
`chars`: you can choose charset from [CHARSET](src/spinner/charset.cr) `default = Spinner::Charset[:pipe]`
|
2015-12-28 07:54:44 +00:00
|
|
|
|
|
2015-12-30 12:07:31 +00:00
|
|
|
|
## Examples
|
|
|
|
|
|
|
|
|
|
```crystal
|
|
|
|
|
require "spinner"
|
|
|
|
|
require "colorize"
|
|
|
|
|
|
2015-12-30 14:21:42 +00:00
|
|
|
|
chars = Spinner::Charset[:arrow].map do |c|
|
2015-12-30 12:07:31 +00:00
|
|
|
|
c.colorize(:light_green)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
spin = Spin.new(0.2, chars)
|
|
|
|
|
spin.start
|
|
|
|
|
sleep 3
|
|
|
|
|
spin.stop
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
![Color](/images/color.gif)
|
|
|
|
|
|
2015-12-28 07:54:44 +00:00
|
|
|
|
## Contributing
|
|
|
|
|
|
|
|
|
|
1. Fork it ( https://github.com/askn/spinner/fork )
|
|
|
|
|
2. Create your feature branch (git checkout -b my-new-feature)
|
|
|
|
|
3. Commit your changes (git commit -am 'Add some feature')
|
|
|
|
|
4. Push to the branch (git push origin my-new-feature)
|
|
|
|
|
5. Create a new Pull Request
|
|
|
|
|
|
|
|
|
|
## Contributors
|
|
|
|
|
|
|
|
|
|
- [askn](https://github.com/askn) Aşkın Gedik - creator, maintainer
|