File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change 21
21
use function is_array ;
22
22
use function is_object ;
23
23
use function is_string ;
24
+ use function ksort ;
24
25
use function method_exists ;
25
26
use function str_pad ;
26
27
use function strlen ;
@@ -290,12 +291,14 @@ public function displayHelp(string $err = ''): void
290
291
echo Color::render ("<red>ERROR</red>: $ err \n\n" );
291
292
}
292
293
293
- $ commandWidth = $ this ->keyWidth ;
294
294
// help
295
+ $ len = $ this ->keyWidth ;
295
296
$ help = "Welcome to the Lite Console Application. \n\n<comment>Available Commands:</comment> \n" ;
297
+ $ data = $ this ->messages ;
298
+ ksort ($ data );
296
299
297
- foreach ($ this -> messages as $ command => $ item ) {
298
- $ command = str_pad ($ command , $ commandWidth , ' ' );
300
+ foreach ($ data as $ command => $ item ) {
301
+ $ command = str_pad ($ command , $ len , ' ' );
299
302
$ desc = $ item ['desc ' ] ? ucfirst ($ item ['desc ' ]) : 'No description for the command ' ;
300
303
$ help .= " $ command $ desc \n" ;
301
304
}
@@ -322,11 +325,12 @@ public function displayCommandHelp(string $name): void
322
325
];
323
326
} else {
324
327
$ checkVar = true ;
328
+ $ userHelp = $ config ['help ' ];
325
329
326
330
$ nodes = [
327
331
ucfirst ($ config ['desc ' ]),
328
332
"<comment>Usage:</comment> \n " . ($ config ['usage ' ] ?: $ usage ),
329
- $ config [ ' help ' ]
333
+ $ userHelp ? $ userHelp . "\n" : ''
330
334
];
331
335
}
332
336
You can’t perform that action at this time.
0 commit comments