承接 mrdatawolf/multiline-progressbar 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

mrdatawolf/multiline-progressbar

Composer 安装命令:

composer require mrdatawolf/multiline-progressbar

包简介

Creates a group of commandline progressbars to interact with.

README 文档

README

Display multiple progressbars and update them at the same time.

Use case:

Display one or more progressbars in the console at the same time

Composer Install

Add the following to your composer.json

{
    "require": {
        "mrdatawolf/multiline-progressbar": "dev-master"
    }
}

5.1 Notes

This has only been tested on Laravel 5.1 but probably works with other versions

It allows up to 3 rows of progressbars and a messagebar to be run as a group.

Example

$totalBars = 3;
$xMax = 3;
$yMax = ($totalBars > 1) ? 4 : 0;
$zMax = ($totalBars > 2) ? 10 : 0;
$totalYs=0;
$totalZs=0;
$this->progressBar = new MultilineProgressbar($this->output, 'Processing Events', '|', $xMax, $yMax, $zMax);
if($this->option('debug')) {
    $this->progressBar->debug();
}
$this->progressBar->start();
$this->progressBar->setMessage('Working thru ' . $xMax . ' primary blocks and '. $yMax . ' secondary blocks with ' . $zMax . ' atomic items','message');
for($x=1; $x<=$xMax;$x++) {
    $this->progressBar->setMessage('Working in main block '. ($x), 'progress');
    $this->progressBar->advance(['message','progress']);
    if($totalBars > 1) {
        for ($y = 1; $y <= $yMax; $y++) {
            $totalYs++;
            $this->progressBar->setMessage('Working in secondary group '.$totalYs,'progress2');
            $this->progressBar->advance(['progress2']);
            if($totalBars > 2) {
                for ($z = 1; $z <= $zMax; $z++) {
                    $mainMessageAddendum = ($z % 7 == 0) ? 'foo' : 'bar';
                    $this->progressBar->setMessage('Working thru ' . $xMax . ' primary blocks and '. $yMax . ' secondary blocks with ' . $zMax . ' atomic items - '. $mainMessageAddendum);
                    $totalZs++;
                    usleep(100000);
                    $this->progressBar->setMessageAndSpinAndAdvance('Working with atomic unit '.$totalZs, 'progress3');
                }
            }
            usleep(100000);
        }
    }
    usleep(100000);
}
$this->progressBar->finish();

The above will create 3 progressbars and a "message" bar above the progressbars. It will also put a "spinner" to the right of the message in the message bar.

Sample Output

Working thru 3 primary blocks and 4 secondary blocks with 10 atomic items -> | : 14 secs/14 secs 24.0 MiB
Working in main block 3 : 3/3 [============================] 100%
Working in secondary group 12 : 12/12 [============================] 100%
Working with atomic unit 120 : 120/120 [============================] 100%

Special Thanks

This project was made possible by Let's Go Learn

统计信息

  • 总下载量: 6.5k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-08-27

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固