makinacorpus/drush-progressbar

Simple progress bar API for Drush

1.0.0 2016-06-02 09:15 UTC

This package is auto-updated.

Last update: 2024-11-10 22:04:43 UTC


README

Usage

Given that:

  • you have $total which is the total number of items to process;
  • and $done is the item count processed so far;

you may do:

$total = some_count();

$bar = \DrushProgressBar::create();
$bar->start();

$done = 0;
foreach ($items as $item) {
  process_item($item);

  // Note that here, you could also change the total (yes you can).
  $bar->setProgress($total, ++$done);
}

$bar->end();