22
33namespace Inhere \Console \Examples \Controller ;
44
5- use Toolkit \Cli \Cli ;
65use Inhere \Console \Component \Symbol \ArtFont ;
7- use Toolkit \Cli \Download ;
86use Inhere \Console \Controller ;
97use Inhere \Console \IO \Input ;
108use Inhere \Console \Util \Interact ;
119use Inhere \Console \Util \ProgressBar ;
1210use Inhere \Console \Util \Show ;
11+ use Toolkit \Cli \Cli ;
12+ use Toolkit \Cli \Download ;
1313use Toolkit \PhpUtil \Php ;
1414
1515/**
@@ -29,14 +29,14 @@ protected static function commandAliases(): array
2929 {
3030 return [
3131 // now, 'home:i' is equals to 'home:index'
32- 'i ' => 'index ' ,
32+ 'i ' => 'index ' ,
3333 'prg ' => 'progress ' ,
3434 'pgb ' => 'progressBar ' ,
35- 'l ' => 'list ' ,
36- 'af ' => 'artFont ' ,
37- 'ml ' => 'multiList ' ,
38- 'sl ' => 'splitLine ' ,
39- 'dt ' => 'dynamicText ' ,
35+ 'l ' => 'list ' ,
36+ 'af ' => 'artFont ' ,
37+ 'ml ' => 'multiList ' ,
38+ 'sl ' => 'splitLine ' ,
39+ 'dt ' => 'dynamicText ' ,
4040 ];
4141 }
4242
@@ -49,7 +49,7 @@ protected function init(): void
4949
5050 protected function disabledCommands (): array
5151 {
52- return ['disabled ' ];
52+ return ['disabled ' ];
5353 }
5454
5555 protected function afterExecute (): void
@@ -154,8 +154,8 @@ public function colorCheckCommand(): void
154154
155155 $ this ->output ->aList ([
156156 'basic color output? ' => Cli::isSupportColor () ? '<info>Y</info> ' : 'N ' ,
157- 'ansi char output? ' => Cli::isAnsiSupport () ? 'Y ' : 'N ' ,
158- '256 color output? ' => Cli::isSupport256Color () ? 'Y ' : 'N ' ,
157+ 'ansi char output? ' => Cli::isAnsiSupport () ? 'Y ' : 'N ' ,
158+ '256 color output? ' => Cli::isSupport256Color () ? 'Y ' : 'N ' ,
159159 'font symbol output? ' => Cli::isSupport256Color () ? 'Y ' : 'N ' ,
160160 ], 'color support check ' );
161161 }
@@ -176,8 +176,8 @@ public function artFontCommand(): int
176176 return $ this ->output ->liteError ("Your input font name: $ name, is not exists. Please use '-h' see allowed. " );
177177 }
178178
179- ArtFont::create ()->show ($ name , ArtFont::INTERNAL_GROUP ,[
180- 'type ' => $ this ->input ->getBoolOpt ('italic ' ) ? 'italic ' : '' ,
179+ ArtFont::create ()->show ($ name , ArtFont::INTERNAL_GROUP , [
180+ 'type ' => $ this ->input ->getBoolOpt ('italic ' ) ? 'italic ' : '' ,
181181 'style ' => $ this ->input ->getOpt ('style ' ),
182182 ]);
183183
@@ -193,7 +193,7 @@ public function artFontCommand(): int
193193 public function counterCommand (): int
194194 {
195195 $ total = 120 ;
196- $ ctt = Show::counterTxt ('handling ... ' , 'handled. ' );
196+ $ ctt = Show::counterTxt ('handling ... ' , 'handled. ' );
197197 $ this ->write ('Counter: ' );
198198
199199 while ($ total - 1 ) {
@@ -263,7 +263,7 @@ public function dynamicTextCommand(): void
263263 $ dt = Show::dynamicText ('Complete ' , 'Download file: xyz.zip ... ' );
264264 $ dt ->send ('Start ' );
265265
266- foreach (['Request ' ,'Downloading ' , 'Save ' ] as $ txt ) {
266+ foreach (['Request ' , 'Downloading ' , 'Save ' ] as $ txt ) {
267267 \sleep (2 );
268268 $ dt ->send ($ txt );
269269 }
@@ -287,12 +287,12 @@ public function dynamicTextCommand(): void
287287 */
288288 public function progressCommand ($ input ): int
289289 {
290- $ i = 0 ;
290+ $ i = 0 ;
291291 $ total = 120 ;
292292 if ($ input ->getOpt ('type ' ) === 'bar ' ) {
293293 $ bar = $ this ->output ->progressBar ($ total , [
294- 'msg ' => 'Msg Text ' ,
295- 'doneMsg ' => 'Done Msg Text ' ,
294+ 'msg ' => 'Msg Text ' ,
295+ 'doneMsg ' => 'Done Msg Text ' ,
296296 'doneChar ' => $ input ->getOpt ('done-char ' , '= ' ), // ▓
297297 'waitChar ' => $ input ->getOpt ('wait-char ' , '- ' ), // ░
298298 'signChar ' => $ input ->getOpt ('sign-char ' , '> ' ),
@@ -318,9 +318,9 @@ public function progressCommand($input): int
318318 */
319319 public function progressBarCommand (): void
320320 {
321- $ i = 0 ;
321+ $ i = 0 ;
322322 $ total = 120 ;
323- $ bar = new ProgressBar ();
323+ $ bar = new ProgressBar ();
324324 $ bar ->start (120 );
325325
326326 while ($ i <= $ total ) {
@@ -348,8 +348,8 @@ public function listCommand(): void
348348
349349 $ commands = [
350350 'version ' => 'Show application version information ' ,
351- 'help ' => 'Show application help information ' ,
352- 'list ' => 'List all group and independent commands ' ,
351+ 'help ' => 'Show application help information ' ,
352+ 'list ' => 'List all group and independent commands ' ,
353353 'a only value message text '
354354 ];
355355
@@ -364,18 +364,18 @@ public function multiListCommand(): void
364364 Show::multiList ([
365365 'list0 ' => [
366366 'value in the list 0 ' ,
367- 'key ' => 'value in the list 0 ' ,
367+ 'key ' => 'value in the list 0 ' ,
368368 'key1 ' => 'value1 in the list 0 ' ,
369369 'key2 ' => 'value2 in the list 0 ' ,
370370 ],
371371 'list1 ' => [
372- 'key ' => 'value in the list 1 ' ,
372+ 'key ' => 'value in the list 1 ' ,
373373 'key1 ' => 'value1 in the list 1 ' ,
374374 'key2 ' => 'value2 in the list 1 ' ,
375375 'value in the list 1 ' ,
376376 ],
377377 'list2 ' => [
378- 'key ' => 'value in the list 2 ' ,
378+ 'key ' => 'value in the list 2 ' ,
379379 'value in the list 2 ' ,
380380 'key1 ' => 'value1 in the list 2 ' ,
381381 'key2 ' => 'value2 in the list 2 ' ,
@@ -390,22 +390,22 @@ public function tableCommand(): void
390390 {
391391 $ data = [
392392 [
393- 'id ' => 1 ,
394- 'name ' => 'john ' ,
393+ 'id ' => 1 ,
394+ 'name ' => 'john ' ,
395395 'status ' => 2 ,
396- 396+ 397397 ],
398398 [
399- 'id ' => 2 ,
400- 'name ' => 'tom ' ,
399+ 'id ' => 2 ,
400+ 'name ' => 'tom ' ,
401401 'status ' => 0 ,
402- 402+ 403403 ],
404404 [
405- 'id ' => 3 ,
406- 'name ' => 'jack ' ,
405+ 'id ' => 3 ,
406+ 'name ' => 'jack ' ,
407407 'status ' => 1 ,
408- 408+ 409409 ],
410410 ];
411411 Show::table ($ data , 'table show ' );
@@ -445,9 +445,9 @@ public function tableCommand(): void
445445 public function paddingCommand (): void
446446 {
447447 $ data = [
448- 'Eggs ' => '$1.99 ' ,
448+ 'Eggs ' => '$1.99 ' ,
449449 'Oatmeal ' => '$4.99 ' ,
450- 'Bacon ' => '$2.99 ' ,
450+ 'Bacon ' => '$2.99 ' ,
451451 ];
452452
453453 Show::padding ($ data , 'padding data show ' );
@@ -482,8 +482,8 @@ public function envCommand(): void
482482 {
483483 $ info = [
484484 'phpVersion ' => PHP_VERSION ,
485- 'env ' => 'test ' ,
486- 'debug ' => true ,
485+ 'env ' => 'test ' ,
486+ 'debug ' => true ,
487487 ];
488488
489489 Show::panel ($ info );
@@ -505,7 +505,7 @@ public function downCommand(): int
505505 }
506506
507507 $ saveAs = $ this ->input ->getArg ('saveAs ' );
508- $ type = $ this ->input ->getArg ('type ' , 'text ' );
508+ $ type = $ this ->input ->getArg ('type ' , 'text ' );
509509
510510 if (!$ saveAs ) {
511511 $ saveAs = __DIR__ . '/ ' . basename ($ url );
0 commit comments