ProgressBar

NAME

Term::ProgressBar - Show a progress bar as you do something

SYNOPSIS

use Term::ProgressBar;
my @items = ...;
    my $bar = Term::ProgressBar.new( :count(@items.elems) );
    for @items -> $x, $item {
        do-something($item);
        $bar->update($x);
    }
$bar.message('done');

This class implements a simply progress bar.

METHODS

This class provides the following methods:

METHOD

Term::ProgressBar.new(...)

Constructs a new progress bar object. The constructor accepts the following named parameters:

  • :count(Int)

    The total number of items for the progress bar. Default to 100.

  • :name(Cool:D)

    A name to prefix to the beginning of the bar. Default to a single sapce.

  • :width(Int)

    The width of the progress bar as a number of graphemes. Default to 100.

  • :p(Bool)

    If this is true, then the bar will include a percent indicator at the right end of the bar.

  • :t(Bool)

    If this is true, then the bar will include an eta estimate at the right end of the bar.

  • :left(Cool:D)

    The string to use for the left side of the bar. Defaults to [.

  • :right(Cool:D)

    The string to use for the left side of the bar. Defaults to ].

  • :style(Cool:D)

    The string to use for the body of the bar. Default to =.

METHOD

$bar.update(Int:D $items)

This method tells the bar to update its indicator to show that $items number of have been completed.

METHOD

$bar.message(Cool:D $message)

Call this method to indicate that you are done. The $message is actually optional. If you provide one it will be printed in place of the bar.

The Camelia image is copyright 2009 by Larry Wall. "Raku" is trademark of the Yet Another Society. All rights reserved.