Skip to content

makinacorpus/drush-progressbar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

Drush progress bar API

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();