NAME

Term::ProgressSpinner - Terminal Progress bars!

VERSION

Version 0.05

SYNOPSIS

        use Term::ProgressSpinner;
        my $ps = Term::ProgressSpinner->new();
        $ps->slowed(0.1);
        $ps->start(50);
        while ($ps->advance()) {}

        ...

        my $s1 = $ps->start(20);
        my $s2 = $ps->start(10);
        my $s3 = $ps->start(50);
        my $s4 = $ps->start(30);

        while (!$ps->finished) {
                $ps->advance($s1) unless $s1->finished;
                $ps->advance($s2) unless $s2->finished;
                $ps->advance($s3) unless $s3->finished;
                $ps->advance($s4) unless $s4->finished;
        }

        ...

        $s1 = $ps->start(20);
        $s2 = $ps->start(10);
        $s3 = $ps->start(50);
        $s4 = $ps->start(30);

        while ($ps->advance()) {}

SUBROUTINES/METHODS

new

Instantiate a new Term::ProgressSpinner Object.

        Term::ProgressSpinner->new(
                text_color => 'white',
                total_color => 'white',
                counter_color => 'white',
                percent_color => 'white',
                percentage_color => 'white',
                percents_color => 'white',
                spinner_color => 'white',
                elapsed_color => 'white',
                start_epoch_color => 'white',
                last_elapsed_color => 'white',
                last_advance_epoch_color => 'white',
                estimate_color => 'white',
                epoch_color => 'white',
                per_second_color => 'white',
                progress_color => 'white',
                spinner => 'bar',
                progress_width => 20,
                progress => 'bar',
                output => \*STDERR,
                progress_spinner_index => 0,
                progress_spinners => [],
                precision => 3,
                message => "{progress} {spinner} processed {percents} of {counter}/{total} {elapsed}/{estimate}",
                terminal_height => 0,
                terminal_line => 0,
        );

progress

The name of the progress bar that will be rendered. Currently the following options are valid:

arrow
        │→→→→→→→→→→→→→→→→→  │
bar
        │█████████████████  │
block
        【================   】
boxed_arrow
        │⍈⍈⍈⍈⍈⍈⍈⍈⍈⍈⍈⍈⍈⍈⍈⍈⍈   │
circle
        │ⓄⓄⓄⓄⓄⓄⓄⓄⓄⓄⓄⓄⓄⓄⓄⓄⓄ   │
den_circle
        │⏂⏂⏂⏂⏂⏂⏂⏂⏂⏂⏂⏂⏂⏂⏂⏂⏂   │
den_triangle
        │⏅⏅⏅⏅⏅⏅⏅⏅⏅⏅⏅⏅⏅⏅⏅⏅⏅   │
dots
        │▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒   │
equal
        [=================   ]
hash
        [#################   ]
horizontal_lines
        │▤▤▤▤▤▤▤▤▤▤▤▤▤▤▤▤▤   │
lines
        │≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡   │
shekel
        │₪₪₪₪₪₪₪₪₪₪₪₪₪₪₪₪₪   │
square
        │■■■■■■■■■■■■■■■■■   │
triangle
        │▶︎▶︎▶︎▶︎▶︎▶︎▶︎▶︎▶︎▶︎▶︎▶︎▶︎▶︎▶︎▶︎▶︎   │

You can also define your own custom progress bar.

        BEGIN {
                my %PROGRESS = %Term::ProgressSpinners::PROGRESS;
                $PROGRESS{custom} = {
                        chars =>  ['[', "~", ']']
                };
        }

        ...
        
        $ps->progress('custom');

progress_width

The width of the progress bar the default value is 20 characters.

spinner

The name of the spinner that will be rendered. Currently the following options are valid:

around
        ⠈⡙
bar
        ▁▇▃
circle
circle_half
clock
        🕘
color_circle
        🟢
color_cirlces
        🟢⚫️🔴
color_square
        🟩
color_squares
        🟩🟪🟫
dots
earth
        🌎
material
         ▁▁▁▁██████████████▁▁
moon
        🌖
pipe
pong
        ▐    ⠠   ▌

You can also define your own custom spinner.

        BEGIN {
                my %SPINNERS = %Term::ProgressSpinners::SPINNERS;
                $SPINNERS{custom} = {
                        width => 3,
                        index => [1, 2, 3], 
                        chars => [
                                "▁",
                                "▂",
                                "▃",
                                "▄",
                                "▅",
                                "▆",
                                "▇",
                                "█"
                        ]
                };
        }

        ...
        
        $ps->spinner('custom');
                

output

The output handle to print the progress spinner to. The default is STDERR.

message

Configure how the progress spinner is drawn.

        "{progress} {spinner} processed {percents} of {counter}/{total} {elapsed}/{estimate}",

This uses placeholders and currently the following options are available:

progress

Draw the progress bar.

spinner

Draw The spinner.

counter

The current step count.

total

The total number of steps.

percent

The integer percent of the total that has completed.

percents

The formatted percent of the total that has completed.

percentage

The integer percentage between percent and the total.

percentages

The formatted percentage between percent and the total.

start_epoch

The epoch time when the progress spinner was started in milliseconds.

start_epoch_second

The epoch time when the progress spinner was started in seconds.

epoch

The current epoch time in milliseconds.

epoch_second

The current epoch time in seconds.

last_advance_epoch

The last advanced epoch set when advance was previously called in milliseconds.

last_advance_epoch

The last advanced epoch set when advance was previously called in seconds.

elapsed

The time that has elapsed since the start_epoch in milliseconds.

elapsed_second

The time that has elapsed since the start_epoch in seconds.

last_elapsed

The time that has elapsed since the last_advance_epoch in milliseconds.

last_elapsed_second

The time that has elapsed since the last_advance_epoch in seconds.

estimate

An estimate for when the progress bar will be complete in milliseconds.

estimate_second

An estimate for when the progress bar will be complete in seconds.

per_second

The number of advances per second.

terminal_height

Specify The height of the current terminal, if not set then Term::Size::Any is used.

terminal_line

Specify the line number to render the progress spinner, if not set then the code attempts to detect the current terminal line number.

precision

Specifiy the precision to render times and durations. The default is 3 decimal places.

text_color

Specify the colour of the message text. See the COLORS section for valid options.

spinner_color

Specify the colour of the message spinner. See the COLORS section for valid options.

progress_color

Specify the colour of the message progress bar. See the COLORS section for valid options.

total_color

Specify the colour of the message total text. See the COLORS section for valid options.

counter_color

Specify the colour of the message counter text. See the COLORS section for valid options.

percent_color

Specify the colour of the message percent text. See the COLORS section for valid options.

percentage_color

Specify the colour of the message percentage text. See the COLORS section for valid options.

percentages_color

Specify the colour of the message percentages text. See the COLORS section for valid options.

percents_color

Specify the colour of the message percents text. See the COLORS section for valid options.

elapsed_color

Specify the colour of the message elapsed text. See the COLORS section for valid options.

start_epoch_color

Specify the colour of the message start epoch text. See the COLORS section for valid options.

last_elapsed_color

Specify the colour of the message last elapsed text. See the COLORS section for valid options.

last_advance_epoch_color

Specify the colour of the message last advance epoch text. See the COLORS section for valid options.

estimate_color

Specify the colour of the message estimate text. See the COLORS section for valid options.

epoch_color

Specify the colour of the message epoch text. See the COLORS section for valid options.

per_second_color

Specify the colour of the message per second text. See the COLORS section for valid options.

start

Initiate a new progress spinner.

        $ps->start(1000);

advance

Advance a step.

        $ps->advance.

draw

Draw the progress spinner.

        $ps->draw

finish

End the progress spinner.

        $ps->finish

drawn

Get or Set whether the progress spinner has been drawn already.

        $ps->drawn

precision

Get or Set the precision of time/duration fields.

        $ps->precision(3); # sets precision to three decimal places

progress_spinner_index

Get or Set the progress spinner index, this is usefull when rendering multiple progress spinners in parallel.

        $ps->progress_spinner_index($index);

progress_spinners

Get or Set the progress spinners ArrayRef. this is usefull when rendering multiple progress spinners in parallel.

        $ps->progess_spinners([Term::ProgressSpinner->new()->start(100)]);

savepos

Save the current terminal position for the progress spinner to be drawn.

        $ps->savepos;

loadpos

Load the progress spinner saved terminal position.

        $ps->loadpos;

clear

Remove the progress spinner.

        $ps->clear

terminal_height

Get or Set the current user defined terminal_height.

        $ps->terminal_height($height);

terminal_line

Get or Set the current user defined terminal_line.

        $ps->terminal_height($line);

message

Get or Set the progress spinner message string.

        $ps->message("{progress} {spinner} processed {percents} of {counter}/{total}");

output

Get or Set the output.

        $ps->output(*\STDERR);

total

Get or Set the total number of steps.

        $ps->total(1000);

slowed

Get or Set whether to intentionally slow down the progress bar.

        $ps->slowed(0.01);

counter

Get or Set the current counter step

        $ps->counter

start_epoch

Get or Set the start epoch.

last_advance_epoch

Get or Set the last advance epoch

text_color

Get or Set the text color.

        $ps->text_color($color)

spinner

Get or set the spinner.

        $ps->spinner($spinner)

spinner_color

Get or Set the spinner color.

        $ps->spinner_color($color)

progress

Get or set the progress.

        $ps->progress($progress);

progress_color

Get or Set the progress color.

        $ps->progress_color($color)

progress_width

Get or Set the progress width.

        $ps->progress_width($width)

percent_color

Get or Set the percent color.

        $ps->percent_color($color)

percents_color

Get or Set the percents color.

        $ps->percents_color($color)

percentage_color

Get or Set the percentage color.

        $ps->percentage_color($color)

percentages_color

Get or Set the percentages color.

        $ps->percentages_color($color)

total_color

Get or Set the total color.

        $ps->total_color($color)

counter_color

Get or Set the counter color.

        $ps->counter_color($color)

elapsed_color

Get or Set the elapsed color.

        $ps->elapsed_color($color)

last_elapsed_color

Get or Set the last elapsed color.

        $ps->last_elapsed_color($color)

estimate_color

Get or Set the estimate color.

        $ps->estimate_color($color)

last_advance_epoch_color

Get or Set the last advance epoch color.

        $ps->last_advance_epoch_color($color)

start_epoch_color

Get or Set the start epoch color.

        $ps->start_epoch_color($color)

epoch_color

Get or Set the epoch color.

        $ps->epoch_color($color)

per_second_color

Get or Set the per second color.

        $ps->per_second_color($color)

sleep

Sleep the programe for milliseconds.

        $ps->sleep(0.05);

COLORS

The following are valid colours that can be specified for rendering the progress spinner.

        $ps->spinner_color('black on_bright_black');
black
black on_blue
black on_bright_black
black on_bright_blue
black on_bright_cyan
black on_bright_green
black on_bright_magenta
black on_bright_red
black on_bright_white
black on_bright_yellow
black on_cyan
black on_green
black on_magenta
black on_red
black on_white
black on_yellow
blue
blue on_black
blue on_bright_black
blue on_bright_blue
blue on_bright_cyan
blue on_bright_green
blue on_bright_magenta
blue on_bright_red
blue on_bright_white
blue on_bright_yellow
blue on_cyan
blue on_green
blue on_magenta
blue on_red
blue on_white
blue on_yellow
bright_black
bright_black on_black
bright_black on_blue
bright_black on_bright_blue
bright_black on_bright_cyan
bright_black on_bright_green
bright_black on_bright_magenta
bright_black on_bright_red
bright_black on_bright_white
bright_black on_bright_yellow
bright_black on_cyan
bright_black on_green
bright_black on_magenta
bright_black on_red
bright_black on_white
bright_black on_yellow
bright_blue
bright_blue on_black
bright_blue on_blue
bright_blue on_bright_black
bright_blue on_bright_cyan
bright_blue on_bright_green
bright_blue on_bright_magenta
bright_blue on_bright_red
bright_blue on_bright_white
bright_blue on_bright_yellow
bright_blue on_cyan
bright_blue on_green
bright_blue on_magenta
bright_blue on_red
bright_blue on_white
bright_blue on_yellow
bright_cyan
bright_cyan on_black
bright_cyan on_blue
bright_cyan on_bright_black
bright_cyan on_bright_blue
bright_cyan on_bright_green
bright_cyan on_bright_magenta
bright_cyan on_bright_red
bright_cyan on_bright_white
bright_cyan on_bright_yellow
bright_cyan on_cyan
bright_cyan on_green
bright_cyan on_magenta
bright_cyan on_red
bright_cyan on_white
bright_cyan on_yellow
bright_green
bright_green on_black
bright_green on_blue
bright_green on_bright_black
bright_green on_bright_blue
bright_green on_bright_cyan
bright_green on_bright_magenta
bright_green on_bright_red
bright_green on_bright_white
bright_green on_bright_yellow
bright_green on_cyan
bright_green on_green
bright_green on_magenta
bright_green on_red
bright_green on_white
bright_green on_yellow
bright_magenta
bright_magenta on_black
bright_magenta on_blue
bright_magenta on_bright_black
bright_magenta on_bright_blue
bright_magenta on_bright_cyan
bright_magenta on_bright_green
bright_magenta on_bright_red
bright_magenta on_bright_white
bright_magenta on_bright_yellow
bright_magenta on_cyan
bright_magenta on_green
bright_magenta on_magenta
bright_magenta on_red
bright_magenta on_white
bright_magenta on_yellow
bright_red
bright_red on_black
bright_red on_blue
bright_red on_bright_black
bright_red on_bright_blue
bright_red on_bright_cyan
bright_red on_bright_green
bright_red on_bright_magenta
bright_red on_bright_white
bright_red on_bright_yellow
bright_red on_cyan
bright_red on_green
bright_red on_magenta
bright_red on_red
bright_red on_white
bright_red on_yellow
bright_white
bright_white on_black
bright_white on_blue
bright_white on_bright_black
bright_white on_bright_blue
bright_white on_bright_cyan
bright_white on_bright_green
bright_white on_bright_magenta
bright_white on_bright_red
bright_white on_bright_yellow
bright_white on_cyan
bright_white on_green
bright_white on_magenta
bright_white on_red
bright_white on_white
bright_white on_yellow
bright_yellow
bright_yellow on_black
bright_yellow on_blue
bright_yellow on_bright_black
bright_yellow on_bright_blue
bright_yellow on_bright_cyan
bright_yellow on_bright_green
bright_yellow on_bright_magenta
bright_yellow on_bright_red
bright_yellow on_bright_white
bright_yellow on_cyan
bright_yellow on_green
bright_yellow on_magenta
bright_yellow on_red
bright_yellow on_white
bright_yellow on_yellow
cyan
cyan on_black
cyan on_blue
cyan on_bright_black
cyan on_bright_blue
cyan on_bright_cyan
cyan on_bright_green
cyan on_bright_magenta
cyan on_bright_red
cyan on_bright_white
cyan on_bright_yellow
cyan on_green
cyan on_magenta
cyan on_red
cyan on_white
cyan on_yellow
green
green on_black
green on_blue
green on_bright_black
green on_bright_blue
green on_bright_cyan
green on_bright_green
green on_bright_magenta
green on_bright_red
green on_bright_white
green on_bright_yellow
green on_cyan
green on_magenta
green on_red
green on_white
green on_yellow
magenta
magenta on_black
magenta on_blue
magenta on_bright_black
magenta on_bright_blue
magenta on_bright_cyan
magenta on_bright_green
magenta on_bright_magenta
magenta on_bright_red
magenta on_bright_white
magenta on_bright_yellow
magenta on_cyan
magenta on_green
magenta on_red
magenta on_white
magenta on_yellow
red
red on_black
red on_blue
red on_bright_black
red on_bright_blue
red on_bright_cyan
red on_bright_green
red on_bright_magenta
red on_bright_red
red on_bright_white
red on_bright_yellow
red on_cyan
red on_green
red on_magenta
red on_white
red on_yellow
white
white on_black
white on_blue
white on_bright_black
white on_bright_blue
white on_bright_cyan
white on_bright_green
white on_bright_magenta
white on_bright_red
white on_bright_white
white on_bright_yellow
white on_cyan
white on_green
white on_magenta
white on_red
white on_yellow
yellow
yellow on_black
yellow on_blue
yellow on_bright_black
yellow on_bright_blue
yellow on_bright_cyan
yellow on_bright_green
yellow on_bright_magenta
yellow on_bright_red
yellow on_bright_white
yellow on_bright_yellow
yellow on_cyan
yellow on_green
yellow on_magenta
yellow on_red
yellow on_white

AUTHOR

LNATION, <thisusedtobeanemail at gmail.com>

BUGS

Please report any bugs or feature requests to bug-term-progressspinner at rt.cpan.org, or through the web interface at https://rt.cpan.org/NoAuth/ReportBug.html?Queue=Term-ProgressSpinner. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc Term::ProgressSpinner

You can also look for information at:

ACKNOWLEDGEMENTS

LICENSE AND COPYRIGHT

This software is Copyright (c) 2020 by LNATION.

This is free software, licensed under:

  The Artistic License 2.0 (GPL Compatible)