<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;"># Terminal::Spinners
Simple spinners and progress bars for Perl 6.

## Install
```bash
zef install Terminal::Spinners
```

## Usage
Classic Spinner ```|/-\```
```perl
my $spinner = Spinner.new;                        # a new default (classic) spinner 
my $promise = Promise.start: { sleep 2; 40 + 2 }; # promise of your long running process  
my $result  = $spinner.await: $promise;           # await returns the promise result
```
-or-
```perl
my $classic = Spinner.new;   # a new default (classic) spinner 
my $promise = start sleep 2; # promise of your long running process
until $promise.status {
    $classic.next;           # prints the next spinner frame
}
```

Hash Progress Bar ```[##########..........]50.00%```
```perl
my $hash-bar = Bar.new;            # defaults to the hash progress bar
$hash-bar.show: 0;                 # print a 0% progress bar
for 1 .. 3000 {
    my $percent = $_ / 3000 * 100; # calculate a percentage
    sleep 0.0002;                  # do iterative work here
    $hash-bar.show: $percent;      # print the progress bar and percent
}
```

## More options
For spinners you can set the speed:
```perl
my $spinner = Spinner.new: speed =&gt; 0; # speed in seconds
# defaults to 0.08. this provides smooth animation for use as in the example above.
# 0 seconds can be useful if you want to print the next frame each time an action occurs.
``` 
And change the type of spinner:
```perl
my $spinner = Spinner.new: type =&gt; 'bounce';
```
Choose from these types:
&lt;pre&gt;
classic     | / - \
bounce      [=   ] [==  ] [=== ] [ ===] [  ==] [   =] [    ] [   =] [  ==] [ ===] [====] [=== ] [==  ] [=   ] [    ]
bounce2     ( â—    ) (  â—   ) (   â—  ) (    â— ) (     â—) (    â— ) (   â—  ) (  â—   ) ( â—    ) (â—     )
dots        â&nbsp;‹ â&nbsp;™ â&nbsp;¹ â&nbsp;¸ â&nbsp;¼ â&nbsp;´ â&nbsp;¦ â&nbsp;§ â&nbsp;‡ â&nbsp;
dots2       â¢„ â¢‚ â¢ â¡ â¡ˆ â¡ â¡&nbsp;
dots3       â&nbsp;ˆ â&nbsp; â&nbsp;&nbsp; â¢€ â¡€ â&nbsp;„ â&nbsp;‚ â&nbsp;
three-dots  .  .. ...
three-dots2 .  .. ... ..  .
bar         â–  â–ƒ  â–„  â–…  â–†  â–‡  â–†  â–…  â–„  â–ƒ  â–
bar2        â–  â–Ž  â–  â–Œ  â–Š  â–‰  â–Š  â–‹  â–Œ  â–  â–Ž
&lt;/pre&gt;

For bars you can change the length:
```perl
my $bar = Bar.new: length =&gt; 50;
```
And you can change the type:
```perl
my $bar = Bar.new: type =&gt; 'equals';
```
Choose from these types:
&lt;pre&gt;
hash   [##########..........]50.00%
equals [==========          ]50.00%
&lt;/pre&gt;

## Copyright
Copyright (c) 2018, github:ryn1x

## License
Terminal::Spinners is released under the Artistic License 2.0.
</pre></body></html>