@@ -418,7 +418,7 @@ public function showHelpInfo($quit = true, string $command = null)
418418 $ sep = $ this ->delimiter ;
419419
420420 $ this ->output ->helpPanel ([
421- 'usage ' => "$ script <info>{command}</info> [arg0 arg1=value1 arg2=value2 ...] [--opt -v -h ...] " ,
421+ 'usage ' => "$ script <info>{command}</info> [--opt -v -h ...] [arg0 arg1 arg2=value2 ...] " ,
422422 'example ' => [
423423 "$ script test (run a independent command) " ,
424424 "$ script home {$ sep }index (run a command of the group) " ,
@@ -471,27 +471,29 @@ public function showCommandList($quit = true)
471471 $ desPlaceholder = 'No description of the command ' ;
472472
473473 // all console controllers
474- $ controllerArr [] = PHP_EOL . '- <bold>Group Commands</bold> ' ;
475- $ controllers = $ this ->controllers ;
476- ksort ($ controllers );
474+ if ($ controllers = $ this ->controllers ) {
475+ \ksort ($ controllers );
476+ $ controllerArr [] = PHP_EOL . '- <bold>Group Commands</bold> ' ;
477+ }
477478
478479 foreach ($ controllers as $ name => $ controller ) {
479480 $ hasGroup = true ;
480481 /** @var AbstractCommand $controller */
481482 $ desc = $ controller ::getDescription () ?: $ desPlaceholder ;
482483 $ aliases = $ this ->getCommandAliases ($ name );
483- $ extra = $ aliases ? Helper::wrapTag (' [alias: ' . implode (', ' , $ aliases ) . '] ' , 'info ' ) : '' ;
484+ $ extra = $ aliases ? Helper::wrapTag (' [alias: ' . \ implode (', ' , $ aliases ) . '] ' , 'info ' ) : '' ;
484485 $ controllerArr [$ name ] = $ desc . $ extra ;
485486 }
486487
487- if (!$ hasGroup ) {
488+ if (!$ hasGroup && $ this -> isDebug () ) {
488489 $ controllerArr [] = '... Not register any group command(controller) ' ;
489490 }
490491
491492 // all independent commands, Independent, Single, Alone
492- $ commands = $ this ->commands ;
493- $ commandArr [] = PHP_EOL . '- <bold>Alone Commands</bold> ' ;
494- ksort ($ commands );
493+ if ($ commands = $ this ->commands ) {
494+ $ commandArr [] = PHP_EOL . '- <bold>Alone Commands</bold> ' ;
495+ \ksort ($ commands );
496+ }
495497
496498 foreach ($ commands as $ name => $ command ) {
497499 $ desc = $ desPlaceholder ;
@@ -513,13 +515,13 @@ public function showCommandList($quit = true)
513515 $ commandArr [$ name ] = $ desc . $ extra ;
514516 }
515517
516- if (!$ hasCommand ) {
518+ if (!$ hasCommand && $ this -> isDebug () ) {
517519 $ commandArr [] = '... Not register any alone command ' ;
518520 }
519521
520522 // built in commands
521523 $ internalCommands = static ::$ internalCommands ;
522- ksort ($ internalCommands );
524+ \ ksort ($ internalCommands );
523525
524526 // built in options
525527 $ internalOptions = FormatUtil::alignmentOptions (self ::$ internalOptions );
0 commit comments