88
99namespace Inhere \Console \Examples \Controller ;
1010
11+ use Inhere \Console \Component \Formatter \HelpPanel ;
12+ use Inhere \Console \Component \Formatter \Panel ;
1113use Inhere \Console \Component \Symbol \Char ;
1214use Inhere \Console \Component \Symbol \Emoji ;
13- use Toolkit \Cli \Color ;
1415use Inhere \Console \Controller ;
1516use Inhere \Console \IO \Input ;
1617use Inhere \Console \Util \Show ;
18+ use Toolkit \Cli \Color ;
1719use Toolkit \Cli \Highlighter ;
1820
1921/**
@@ -28,9 +30,9 @@ class ShowController extends Controller
2830 public static function commandAliases (): array
2931 {
3032 return [
31- 'hp ' => 'helpPanel ' ,
33+ 'hp ' => 'helpPanel ' ,
3234 'hpl ' => 'helpPanel ' ,
33- 'hl ' => 'highlight ' ,
35+ 'hl ' => 'highlight ' ,
3436 ];
3537 }
3638
@@ -93,8 +95,8 @@ public function panelCommand(): void
9395 {
9496 $ data = [
9597 'application version ' => '1.2.0 ' ,
96- 'system version ' => '5.2.3 ' ,
97- 'key ' => 'value ... ' ,
98+ 'system version ' => '5.2.3 ' ,
99+ 'key ' => 'value ... ' ,
98100 'a only value message text ' ,
99101 ];
100102
@@ -105,6 +107,13 @@ public function panelCommand(): void
105107 Show::panel ($ data , 'panel show ' , [
106108 'borderChar ' => '= '
107109 ]);
110+
111+ Panel::create ([
112+ 'data ' => $ data ,
113+ 'title ' => 'panel show ' ,
114+ 'titleBorder ' => '= ' ,
115+ 'footBorder ' => '= ' ,
116+ ])->display ();
108117 }
109118
110119 /**
@@ -209,7 +218,7 @@ public function highlightCommand($in): void
209218 {
210219 // $file = $this->app->getRootPath() . '/examples/routes.php';
211220 $ file = $ this ->app ->getRootPath () . '/src/Utils/Show.php ' ;
212- $ src = \file_get_contents ($ file );
221+ $ src = \file_get_contents ($ file );
213222
214223 $ code = Highlighter::create ()->highlight ($ src , $ in ->getBoolOpt ('ln ' ));
215224
@@ -222,19 +231,19 @@ public function highlightCommand($in): void
222231 public function helpPanelCommand (): void
223232 {
224233 Show::helpPanel ([
225- Show:: HELP_DES => 'a help panel description text. (help panel show) ' ,
226- Show:: HELP_USAGE => 'a usage text ' ,
227- Show:: HELP_ARGUMENTS => [
234+ HelpPanel:: DESC => 'a help panel description text. (help panel show) ' ,
235+ HelpPanel:: USAGE => 'a usage text ' ,
236+ HelpPanel:: ARGUMENTS => [
228237 'arg1 ' => 'arg1 description ' ,
229238 'arg2 ' => 'arg2 description ' ,
230239 ],
231- Show:: HELP_OPTIONS => [
232- '--opt1 ' => 'a long option ' ,
233- '-s ' => 'a short option ' ,
234- '-d ' => 'Run the server on daemon.(default: <comment>false</comment>) ' ,
240+ HelpPanel:: OPTIONS => [
241+ '--opt1 ' => 'a long option ' ,
242+ '-s ' => 'a short option ' ,
243+ '-d ' => 'Run the server on daemon.(default: <comment>false</comment>) ' ,
235244 '-h, --help ' => 'Display this help message '
236245 ],
237- ], false );
246+ ]);
238247 }
239248
240249 /**
@@ -272,22 +281,22 @@ public function jsonCommand(): void
272281 {
273282 $ data = [
274283 [
275- 'id ' => 1 ,
276- 'name ' => 'john ' ,
284+ 'id ' => 1 ,
285+ 'name ' => 'john ' ,
277286 'status ' => 2 ,
278- 287+ 279288 ],
280289 [
281- 'id ' => 2 ,
282- 'name ' => 'tom ' ,
290+ 'id ' => 2 ,
291+ 'name ' => 'tom ' ,
283292 'status ' => 0 ,
284- 293+ 285294 ],
286295 [
287- 'id ' => 3 ,
288- 'name ' => 'jack ' ,
296+ 'id ' => 3 ,
297+ 'name ' => 'jack ' ,
289298 'status ' => 1 ,
290- 299+ 291300 ],
292301 ];
293302
0 commit comments