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 2121use function is_array ;
2222use function is_object ;
2323use function is_string ;
24+ use function ksort ;
2425use function method_exists ;
2526use function str_pad ;
2627use function strlen ;
@@ -290,12 +291,14 @@ public function displayHelp(string $err = ''): void
290291 echo Color::render ("<red>ERROR</red>: $ err \n\n" );
291292 }
292293
293- $ commandWidth = $ this ->keyWidth ;
294294 // help
295+ $ len = $ this ->keyWidth ;
295296 $ help = "Welcome to the Lite Console Application. \n\n<comment>Available Commands:</comment> \n" ;
297+ $ data = $ this ->messages ;
298+ ksort ($ data );
296299
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 , ' ' );
299302 $ desc = $ item ['desc ' ] ? ucfirst ($ item ['desc ' ]) : 'No description for the command ' ;
300303 $ help .= " $ command $ desc \n" ;
301304 }
@@ -322,11 +325,12 @@ public function displayCommandHelp(string $name): void
322325 ];
323326 } else {
324327 $ checkVar = true ;
328+ $ userHelp = $ config ['help ' ];
325329
326330 $ nodes = [
327331 ucfirst ($ config ['desc ' ]),
328332 "<comment>Usage:</comment> \n " . ($ config ['usage ' ] ?: $ usage ),
329- $ config [ ' help ' ]
333+ $ userHelp ? $ userHelp . "\n" : ''
330334 ];
331335 }
332336
You can’t perform that action at this time.
0 commit comments