Changeset View
Changeset View
Standalone View
Standalone View
src/console/PhutilConsoleProgressBar.php
<?php | <?php | ||||
/** | /** | ||||
* Show a progress bar on the console. Usage: | * Show a progress bar on the console. Usage: | ||||
* | * | ||||
* // Create a progress bar, and configure the total amount of work that | * // Create a progress bar, and configure the total amount of work that | ||||
* // needs to be done. | * // needs to be done. | ||||
* $bar = id(new PhutilConsoleProgressBar()) | * $bar = (new PhutilConsoleProgressBar()) | ||||
* ->setTotal(count($stuff)); | * ->setTotal(count($stuff)); | ||||
* | * | ||||
* // As you complete the work, update the progress bar. | * // As you complete the work, update the progress bar. | ||||
* foreach ($stuff as $thing) { | * foreach ($stuff as $thing) { | ||||
* do_stuff($thing); | * do_stuff($thing); | ||||
* $bar->update(1); | * $bar->update(1); | ||||
* } | * } | ||||
* | * | ||||
▲ Show 20 Lines • Show All 163 Lines • Show Last 20 Lines |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0