handmade-medium/console-progress-bar

v1.0.1 2017-05-02 16:12 UTC

This package is not auto-updated.

Last update: 2024-09-29 02:07:58 UTC


README

为控制台应用程序提供进度条

  • ConsoleProgressBar = 通用PHP命令行进度条
  • DrushProgressBar = 针对Drush控制台应用程序进行定制

用法

// width of the left title column
$colWidth = 50;
// size of bar
$size = ConsoleProgressBar::SIZE_MEDIUM;
// max value of loop
$max = 100;
// text for column
$text = "Test";
// init
$progressBar = new ConsoleProgressBar($max, $size, $text, $colWidth);
// loop
for($x=1;$x<=$max;$x++) {
$progressBar->showProgress($x);
}
// end
$progressBar->showComplete();

示例

查看 examples/consoleExample.php

> php examples/consoleExample.php
Example Spinner      [X] 100%
Example Small Bar    [=========================] 100%
Example Medium Bar   [==================================================] 100%
Example Large Bar    [====================================================================================================] 100%
Custom Bar           [##################################################] 100%
Custom Spinner       [X] 100%

v1.0.2

  • 添加了 Drush 6 .. 8 的测试
  • 添加了控制台的测试
  • 添加了自定义条和自定义旋转选项
  • 修复了大条问题 - 不超过视窗宽度

v1.0

  • 初始发布