Created
November 10, 2021 16:36
-
-
Save saltlakeryan/9d9b56c269a4d5abe0d7dba4419d37b4 to your computer and use it in GitHub Desktop.
Whirley gig progress indicator for perl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
# Based on this: https://www.perlmonks.org/?node_id=113661 | |
use strict; | |
use Time::HiRes qw( sleep ); | |
#$|=1; | |
our $WHIRLEY_COUNT=-1; | |
#our @WHIRLEY=('-', '\\', '|', '/'); | |
#our @WHIRLEY=('⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'); | |
our @WHIRLEY=('▁', '▂', '▃', '▄', '▅', '▆', '▇', '█', '▇', '▆', '▅', '▄', '▃'); | |
sub whirley { | |
our $WHIRLEY_COUNT; | |
our $WHIRLEY; | |
$WHIRLEY_COUNT = ($WHIRLEY_COUNT + 1) % @WHIRLEY; | |
return @WHIRLEY[$WHIRLEY_COUNT]; | |
} | |
print STDERR "please wait : "; | |
while (1) { | |
sleep 0.3; | |
print STDERR "\b\b\b " . whirley() . " "; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment