@@ -39,7 +39,7 @@ abstract class AbstractApplication implements ApplicationInterface
3939
4040 /** @var array */
4141 protected static $ internalOptions = [
42- '--debug ' => 'Setting the application runtime debug level ' ,
42+ '--debug ' => 'Setting the application runtime debug level(0 - 4) ' ,
4343 '--profile ' => 'Display timing and memory usage information ' ,
4444 '--no-color ' => 'Disable color/ANSI for message output ' ,
4545 '-h, --help ' => 'Display this help message ' ,
@@ -52,7 +52,7 @@ abstract class AbstractApplication implements ApplicationInterface
5252 */
5353 private $ meta = [
5454 'name ' => 'My Console Application ' ,
55- 'debug ' => false ,
55+ 'debug ' => Console:: VERB_ERROR ,
5656 'profile ' => false ,
5757 'version ' => '0.5.1 ' ,
5858 'publishAt ' => '2017.03.24 ' ,
@@ -431,12 +431,23 @@ public function showCommandList($quit = true)
431431
432432 // all console controllers
433433 if ($ controllers = $ this ->controllers ) {
434+ $ hasGroup = true ;
434435 \ksort ($ controllers );
436+ }
437+
438+ // all independent commands, Independent, Single, Alone
439+ if ($ commands = $ this ->commands ) {
440+ $ hasCommand = true ;
441+ \ksort ($ commands );
442+ }
443+
444+ // add split title on both exists.
445+ if ($ hasCommand && $ hasGroup ) {
446+ $ commandArr [] = \PHP_EOL . '- <bold>Alone Commands</bold> ' ;
435447 $ controllerArr [] = \PHP_EOL . '- <bold>Group Commands</bold> ' ;
436448 }
437449
438450 foreach ($ controllers as $ name => $ controller ) {
439- $ hasGroup = true ;
440451 /** @var AbstractCommand $controller */
441452 $ desc = $ controller ::getDescription () ?: $ desPlaceholder ;
442453 $ aliases = $ this ->getCommandAliases ($ name );
@@ -448,15 +459,8 @@ public function showCommandList($quit = true)
448459 $ controllerArr [] = '... Not register any group command(controller) ' ;
449460 }
450461
451- // all independent commands, Independent, Single, Alone
452- if ($ commands = $ this ->commands ) {
453- $ commandArr [] = \PHP_EOL . '- <bold>Alone Commands</bold> ' ;
454- \ksort ($ commands );
455- }
456-
457462 foreach ($ commands as $ name => $ command ) {
458463 $ desc = $ desPlaceholder ;
459- $ hasCommand = true ;
460464
461465 /** @var AbstractCommand $command */
462466 if (\is_subclass_of ($ command , CommandInterface::class)) {
@@ -755,12 +759,12 @@ public function getMeta(string $name = null, $default = null)
755759 }
756760
757761 /**
758- * is Debug
759- * @return boolean| int
762+ * get current debug level value
763+ * @return int
760764 */
761- public function isDebug ()
765+ public function getVerbLevel (): int
762766 {
763- return $ this ->input ->getOpt ('debug ' , $ this ->meta ['debug ' ]);
767+ return ( int ) $ this ->input ->getLongOpt ('debug ' , ( int ) $ this ->meta ['debug ' ]);
764768 }
765769
766770 /**
0 commit comments