@@ -79,7 +79,6 @@ git clone https://github.com/inhere/php-console.git // github
7979// file: examples/app
8080use Inhere\Console\IO\Input;
8181use Inhere\Console\IO\Output;
82- use Inhere\Console\Application;
8382
8483$meta = [
8584 'name' => 'My Console App',
@@ -88,7 +87,7 @@ $meta = [
8887$input = new Input;
8988$output = new Output;
9089// 通常无需传入 $input $output ,会自动创建
91- $app = new Application($meta, $input, $output);
90+ $app = new \Inhere\Console\ Application($meta, $input, $output);
9291
9392// add command routes
9493$app->command('demo', function (Input $in, Output $out) {
@@ -112,7 +111,7 @@ $app->run();
112111
113112添加命令的方式有三种
114113
115- ### 使用闭包
114+ ### 1. 使用闭包
116115
117116如上所示,使用闭包可以快速的添加一个简单的命令
118117
@@ -124,7 +123,7 @@ $app->command('demo', function (Input $in, Output $out) {
124123}, 'this is message for the command');
125124```
126125
127- ### 独立命令
126+ ### 2. 独立命令
128127
129128通过继承 ` Inhere\Console\Command ` 添加独立命令
130129
@@ -165,9 +164,10 @@ class TestCommand extends Command
165164}
166165```
167166
168- ### 命令组
167+ ### 3. 命令组
169168
170169当一些命令相关性较大时,写在同一个文件里更方便阅读和管理。
170+
171171通过继承 ` Inhere\Console\Controller ` 添加一组命令. 即是命令行的控制器
172172
173173``` php
@@ -213,7 +213,7 @@ class HomeController extends Controller
213213}
214214```
215215
216- ### 注册命令
216+ ## 注册命令
217217
218218 在 ` $app->run() ` 之前
219219
0 commit comments