Skip to content

Commit 611fcfe

Browse files
committed
update readme
1 parent 3eca307 commit 611fcfe

File tree

3 files changed

+28
-10
lines changed

3 files changed

+28
-10
lines changed

README.md

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
简洁功能全面的php命令行应用库。提供控制台参数解析, 颜色风格输出, 用户信息交互, 特殊格式信息显示
44

5-
- 命令行应用, 命令行的controller,command 解析运行
5+
- 命令行应用, 命令行的 `controller`, `command` 解析运行
66
- 功能全面的命令行的选项参数解析
7-
- 命令行中功能强大的 input/output 管理、使用
7+
- 命令行中功能强大的 `input`, `output` 管理、使用
88
- 消息文本的多种颜色风格输出支持
9-
- 常用的特殊格式信息显示(panel,help-panel,table,title,list,progressBar)
10-
- 常用的用户信息交互支持(select,confirm,ask)
9+
- 常用的特殊格式信息显示(`section`, `panel`, `padding`, `help-panel`, `table`, `title`, `list`, `progressBar`)
10+
- 常用的用户信息交互支持(`select`, `confirm`, `ask/question`)
1111
- 命令方法注释自动解析(提取为参数 `arguments` 和 选项 `options` 等信息)
1212
- 类似 `symfony/console` 的预定义参数定义支持(按位置赋予参数值)
1313

@@ -85,6 +85,15 @@ $app->run();
8585
添加命令的方式有三种
8686

8787
- 如上所示,使用闭包可以快速的添加一个简单的命令
88+
89+
```php
90+
$app->command('demo', function (Input $in, Output $out) {
91+
$cmd = $in->getCommand();
92+
93+
$out->info('hello, this is a test command: ' . $cmd);
94+
});
95+
```
96+
8897
- 通过继承 `Inhere\Console\Command` 添加独立命令
8998

9099
```php
@@ -121,7 +130,7 @@ use Inhere\Console\Controller;
121130
*/
122131
class HomeController extends Controller
123132
{
124-
const DESCRIPTION = 'default command controller. there are some command usage examples';
133+
protected static $description = 'default command controller. there are some command usage examples';
125134

126135
/**
127136
* this is a command's description message
@@ -143,7 +152,7 @@ class HomeController extends Controller
143152

144153
命令组(eg `HomeController`) 中的命令(eg: `indexCommand`)上注释是可被解析的。
145154

146-
- 当你使用 `php examples/app home -h` 时,可以查看到 `HomeController::indexCommand` 的描述注释文本
155+
- 当你使用 `php examples/app home -h` 时,可以查看到 `HomeController` 的所有命令信息
147156
- 当使用 `php examples/app home/index -h` 时,可以查看到关于 `HomeController::indexCommand` 更详细的信息。包括描述注释文本、`@usage``@example`
148157

149158
> 小提示:注释里面同样支持带颜色的文本输出 `eg: this is a command's description <info>message</info>`

README_en.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
a php console application library.
44

55
- console application, run command/controller
6-
- console input/output
7-
- console color support
6+
- console command-line params parse
7+
- console `input`, `output`
8+
- console color support, format message output
89
- console interactive
910

1011
[中文README](./README.md)

src/Utils/Show.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
namespace Inhere\Console\Utils;
1010

11-
use Inhere\Console\Application;
1211
use Inhere\Console\Style\Style;
1312

1413
/**
@@ -311,7 +310,7 @@ public static function padding(array $data, string $title = null, array $opts =
311310
}
312311

313312
/**
314-
* Show a list
313+
* Show a single list
315314
* ```
316315
* $title = 'list title';
317316
* $data = [
@@ -356,6 +355,15 @@ public static function aList($data, $title = null, array $opts = [])
356355
return self::write($string);
357356
}
358357

358+
/**
359+
* @see Show::aList()
360+
* {@inheritdoc}
361+
*/
362+
public static function sList($data, $title = null, array $opts = [])
363+
{
364+
return self::aList($data, $title, $opts);
365+
}
366+
359367
/**
360368
* Show multi list
361369
* ```

0 commit comments

Comments
 (0)