2
2
3
3
namespace Inhere \Console \Examples \Controller ;
4
4
5
- use Toolkit \Cli \Cli ;
6
5
use Inhere \Console \Component \Symbol \ArtFont ;
7
- use Toolkit \Cli \Download ;
8
6
use Inhere \Console \Controller ;
9
7
use Inhere \Console \IO \Input ;
10
8
use Inhere \Console \Util \Interact ;
11
9
use Inhere \Console \Util \ProgressBar ;
12
10
use Inhere \Console \Util \Show ;
11
+ use Toolkit \Cli \Cli ;
12
+ use Toolkit \Cli \Download ;
13
13
use Toolkit \PhpUtil \Php ;
14
14
15
15
/**
@@ -29,14 +29,14 @@ protected static function commandAliases(): array
29
29
{
30
30
return [
31
31
// now, 'home:i' is equals to 'home:index'
32
- 'i ' => 'index ' ,
32
+ 'i ' => 'index ' ,
33
33
'prg ' => 'progress ' ,
34
34
'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 ' ,
40
40
];
41
41
}
42
42
@@ -49,7 +49,7 @@ protected function init(): void
49
49
50
50
protected function disabledCommands (): array
51
51
{
52
- return ['disabled ' ];
52
+ return ['disabled ' ];
53
53
}
54
54
55
55
protected function afterExecute (): void
@@ -154,8 +154,8 @@ public function colorCheckCommand(): void
154
154
155
155
$ this ->output ->aList ([
156
156
'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 ' ,
159
159
'font symbol output? ' => Cli::isSupport256Color () ? 'Y ' : 'N ' ,
160
160
], 'color support check ' );
161
161
}
@@ -176,8 +176,8 @@ public function artFontCommand(): int
176
176
return $ this ->output ->liteError ("Your input font name: $ name, is not exists. Please use '-h' see allowed. " );
177
177
}
178
178
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 ' : '' ,
181
181
'style ' => $ this ->input ->getOpt ('style ' ),
182
182
]);
183
183
@@ -193,7 +193,7 @@ public function artFontCommand(): int
193
193
public function counterCommand (): int
194
194
{
195
195
$ total = 120 ;
196
- $ ctt = Show::counterTxt ('handling ... ' , 'handled. ' );
196
+ $ ctt = Show::counterTxt ('handling ... ' , 'handled. ' );
197
197
$ this ->write ('Counter: ' );
198
198
199
199
while ($ total - 1 ) {
@@ -263,7 +263,7 @@ public function dynamicTextCommand(): void
263
263
$ dt = Show::dynamicText ('Complete ' , 'Download file: xyz.zip ... ' );
264
264
$ dt ->send ('Start ' );
265
265
266
- foreach (['Request ' ,'Downloading ' , 'Save ' ] as $ txt ) {
266
+ foreach (['Request ' , 'Downloading ' , 'Save ' ] as $ txt ) {
267
267
\sleep (2 );
268
268
$ dt ->send ($ txt );
269
269
}
@@ -287,12 +287,12 @@ public function dynamicTextCommand(): void
287
287
*/
288
288
public function progressCommand ($ input ): int
289
289
{
290
- $ i = 0 ;
290
+ $ i = 0 ;
291
291
$ total = 120 ;
292
292
if ($ input ->getOpt ('type ' ) === 'bar ' ) {
293
293
$ bar = $ this ->output ->progressBar ($ total , [
294
- 'msg ' => 'Msg Text ' ,
295
- 'doneMsg ' => 'Done Msg Text ' ,
294
+ 'msg ' => 'Msg Text ' ,
295
+ 'doneMsg ' => 'Done Msg Text ' ,
296
296
'doneChar ' => $ input ->getOpt ('done-char ' , '= ' ), // ▓
297
297
'waitChar ' => $ input ->getOpt ('wait-char ' , '- ' ), // ░
298
298
'signChar ' => $ input ->getOpt ('sign-char ' , '> ' ),
@@ -318,9 +318,9 @@ public function progressCommand($input): int
318
318
*/
319
319
public function progressBarCommand (): void
320
320
{
321
- $ i = 0 ;
321
+ $ i = 0 ;
322
322
$ total = 120 ;
323
- $ bar = new ProgressBar ();
323
+ $ bar = new ProgressBar ();
324
324
$ bar ->start (120 );
325
325
326
326
while ($ i <= $ total ) {
@@ -348,8 +348,8 @@ public function listCommand(): void
348
348
349
349
$ commands = [
350
350
'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 ' ,
353
353
'a only value message text '
354
354
];
355
355
@@ -364,18 +364,18 @@ public function multiListCommand(): void
364
364
Show::multiList ([
365
365
'list0 ' => [
366
366
'value in the list 0 ' ,
367
- 'key ' => 'value in the list 0 ' ,
367
+ 'key ' => 'value in the list 0 ' ,
368
368
'key1 ' => 'value1 in the list 0 ' ,
369
369
'key2 ' => 'value2 in the list 0 ' ,
370
370
],
371
371
'list1 ' => [
372
- 'key ' => 'value in the list 1 ' ,
372
+ 'key ' => 'value in the list 1 ' ,
373
373
'key1 ' => 'value1 in the list 1 ' ,
374
374
'key2 ' => 'value2 in the list 1 ' ,
375
375
'value in the list 1 ' ,
376
376
],
377
377
'list2 ' => [
378
- 'key ' => 'value in the list 2 ' ,
378
+ 'key ' => 'value in the list 2 ' ,
379
379
'value in the list 2 ' ,
380
380
'key1 ' => 'value1 in the list 2 ' ,
381
381
'key2 ' => 'value2 in the list 2 ' ,
@@ -390,22 +390,22 @@ public function tableCommand(): void
390
390
{
391
391
$ data = [
392
392
[
393
- 'id ' => 1 ,
394
- 'name ' => 'john ' ,
393
+ 'id ' => 1 ,
394
+ 'name ' => 'john ' ,
395
395
'status ' => 2 ,
396
-
396
+
397
397
],
398
398
[
399
- 'id ' => 2 ,
400
- 'name ' => 'tom ' ,
399
+ 'id ' => 2 ,
400
+ 'name ' => 'tom ' ,
401
401
'status ' => 0 ,
402
-
402
+
403
403
],
404
404
[
405
- 'id ' => 3 ,
406
- 'name ' => 'jack ' ,
405
+ 'id ' => 3 ,
406
+ 'name ' => 'jack ' ,
407
407
'status ' => 1 ,
408
-
408
+
409
409
],
410
410
];
411
411
Show::table ($ data , 'table show ' );
@@ -445,9 +445,9 @@ public function tableCommand(): void
445
445
public function paddingCommand (): void
446
446
{
447
447
$ data = [
448
- 'Eggs ' => '$1.99 ' ,
448
+ 'Eggs ' => '$1.99 ' ,
449
449
'Oatmeal ' => '$4.99 ' ,
450
- 'Bacon ' => '$2.99 ' ,
450
+ 'Bacon ' => '$2.99 ' ,
451
451
];
452
452
453
453
Show::padding ($ data , 'padding data show ' );
@@ -482,8 +482,8 @@ public function envCommand(): void
482
482
{
483
483
$ info = [
484
484
'phpVersion ' => PHP_VERSION ,
485
- 'env ' => 'test ' ,
486
- 'debug ' => true ,
485
+ 'env ' => 'test ' ,
486
+ 'debug ' => true ,
487
487
];
488
488
489
489
Show::panel ($ info );
@@ -505,7 +505,7 @@ public function downCommand(): int
505
505
}
506
506
507
507
$ saveAs = $ this ->input ->getArg ('saveAs ' );
508
- $ type = $ this ->input ->getArg ('type ' , 'text ' );
508
+ $ type = $ this ->input ->getArg ('type ' , 'text ' );
509
509
510
510
if (!$ saveAs ) {
511
511
$ saveAs = __DIR__ . '/ ' . basename ($ url );
0 commit comments