elipettingale/laravel-progress-command
Composer 安装命令:
composer require elipettingale/laravel-progress-command
包简介
A simple command which outputs progress bars to the console.
README 文档
README
A simple command which outputs progress bars to the console.
Will output various progress bars which will be updated depending on the key returned by the the fireItem() function.
Example
class TestCommand extends ProgressCommand implements HasInfoBar
{
protected $signature = 'test-command';
protected function getItems()
{
return ['One', 'Two', 'Three', 'Four', 'Five', 'Six', 'Seven', 'Eight', 'Nine', 'Ten'];
}
protected function fireItem($item): string
{
sleep(1);
return array_random(['success', 'error']);
}
public function getItemIdentifier($item): string
{
return $item;
}
protected function getProgressBarBlueprints(): array
{
return [
new ProgressBarBlueprint('success', 'Success', [
'foreground' => 'green'
]),
new ProgressBarBlueprint('error', 'Error', [
'foreground' => 'red'
])
];
}
}
ProgressBarBlueprint
These are how you define the progress bars that get printed to the console. Each blueprint must have a 'key', which is used to identify which progress bar to increment by the fireItem method, and a 'description' which is free text that is used as a label for the progress bar.
统计信息
- 总下载量: 4.37k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-05-18