Skip to content

Commit 085780b

Browse files
committed
update readme
1 parent 231f37f commit 085780b

File tree

6 files changed

+26
-5
lines changed

6 files changed

+26
-5
lines changed

README.md

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
- 命令方法注释自动解析为帮助信息(默认提取 `@usage` `@arguments` `@options` `@example` 等信息)
1515
- 支持输出多种颜色风格的消息文本(`info`, `comment`, `success`, `warning`, `danger`, `error` ... )
1616
- 常用的特殊格式信息显示(`section`, `panel`, `padding`, `helpPanel`, `table`, `tree`, `title`, `list`, `multiList`)
17-
- 丰富的动态信息显示(`pending/loading`, `pointing`, `spinner`, `counterTxt`, `progressTxt`, `progressBar`)
17+
- 丰富的动态信息显示(`pending/loading`, `pointing`, `spinner`, `counterTxt`, `dynamicText`, `progressTxt`, `progressBar`)
1818
- 常用的用户信息交互支持(`select`, `multiSelect`, `confirm`, `ask/question`, `askPassword/askHiddenInput`)
1919
- 支持类似 `symfony/console` 的预定义参数定义(按位置赋予参数值, 需要严格限制参数选项时推荐使用)
2020
- 输出是 `windows` , `linux` 兼容的,不支持颜色的环境会自动去除相关CODE
@@ -440,6 +440,18 @@ public static function title(string $title, array $opts = [])
440440
public static function section(string $title, string|array $body, array $opts = [])
441441
```
442442

443+
### 自定义的动态文本输出
444+
445+
使用 `Show::dynamicTxt()/$output->dynamicTxt()`
446+
447+
![show-progress-txt](docs/screenshots/show-dynamic-text.gif)
448+
449+
### 简单的文本进度输出
450+
451+
使用 `Show::progressTxt()/$output->progressTxt()`
452+
453+
![show-progress-txt](docs/screenshots/show-progress-txt.gif)
454+
443455
### 简单的进度条输出
444456

445457
使用 `Show::progressBar()/$output->progressBar()`
@@ -451,7 +463,6 @@ public static function progressBar(int $total, array $opts = [])
451463
示例代码:
452464

453465
```php
454-
455466
$total = 120;
456467
$bar = Show::progressBar($total, [
457468
'msg' => 'Msg Text',
@@ -467,7 +478,7 @@ while ($i <= $total) {
467478
}
468479
```
469480

470-
![show-progress](docs/screenshots/progress-demo.png)
481+
![show-progress-bar](docs/screenshots/show-progress-bar.gif)
471482

472483
### 列表数据展示输出
473484

67.7 KB
Loading
173 KB
Loading
121 KB
Loading

examples/Controllers/HomeController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -331,14 +331,14 @@ public function counterCommand(): int
331331
}
332332

333333
/**
334-
* dynamic notice message show: spinner
334+
* dynamic spinner message, by Show::spinner()
335335
*/
336336
public function spinnerCommand()
337337
{
338338
$total = 5000;
339339

340340
while ($total--) {
341-
Show::spinner();
341+
Show::spinner('Data handling ');
342342
usleep(100);
343343
}
344344

src/Utils/Show.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1068,6 +1068,16 @@ public static function counterTxt(string $msg, $doneMsg = null)
10681068
yield false;
10691069
}
10701070

1071+
/**
1072+
* @param string $doneMsg
1073+
* @param string|null $fixMsg
1074+
* @return \Generator
1075+
*/
1076+
public static function dynamicTxt(string $doneMsg, string $fixMsg = null)
1077+
{
1078+
return self::dynamicText($doneMsg, $fixMsg);
1079+
}
1080+
10711081
/**
10721082
* @param string $doneMsg
10731083
* @param string|null $fixMsg

0 commit comments

Comments
 (0)