@@ -155,16 +155,29 @@ public function run($exit = true)
155155 }
156156
157157 /**
158+ * dispatch command
158159 * @param string $command A command name
159160 * @return int|mixed
160161 */
161162 abstract protected function dispatch ($ command );
162163
164+ /**
165+ * run a independent command
166+ * {@inheritdoc}
167+ */
168+ abstract public function runCommand ($ name , $ believable = false );
169+
170+ /**
171+ * run a controller's action
172+ * {@inheritdoc}
173+ */
174+ abstract public function runAction ($ name , $ action , $ believable = false , $ standAlone = false );
175+
163176 protected function afterRun ()
164177 {
165178 // display runtime info
166179 if ($ this ->isDebug ()) {
167- $ title = '------------ Runtime Stats -- ---------- ' ;
180+ $ title = '---------- Runtime Stats(debug=true) ---------- ' ;
168181 $ stats = $ this ->meta ['_stats ' ];
169182 $ this ->meta ['_stats ' ] = Helper::runtime ($ stats ['startTime ' ], $ stats ['startMemory ' ], $ stats );
170183 $ this ->output ->write ('' );
@@ -315,7 +328,7 @@ public function showHelpInfo($quit = true)
315328 $ sep = $ this ->delimiter ;
316329
317330 $ this ->output ->helpPanel ([
318- 'usage ' => "$ script [ route|command] [arg0 arg1=value1 arg2=value2 ...] [--opt -v -h ...] " ,
331+ 'usage ' => "$ script { route|command} [arg0 arg1=value1 arg2=value2 ...] [--opt -v -h ...] " ,
319332 'example ' => [
320333 "$ script test (run a independent command) " ,
321334 "$ script home {$ sep }index (run a command of the group) " ,
@@ -366,6 +379,7 @@ public function showCommandList($quit = true)
366379 // all console controllers
367380 $ controllers = $ this ->controllers ;
368381 ksort ($ controllers );
382+
369383 foreach ($ controllers as $ name => $ controller ) {
370384 /** @var AbstractCommand $controller */
371385 $ controllerArr [$ name ] = $ controller ::getDescription () ?: $ desPlaceholder ;
@@ -383,7 +397,7 @@ public function showCommandList($quit = true)
383397 } else if ($ msg = $ this ->getCommandMessage ($ name )) {
384398 $ desc = $ msg ;
385399 } else if (is_string ($ command )) {
386- $ desc = 'A handler: ' . $ command ;
400+ $ desc = 'A handler : ' . $ command ;
387401 } else if (is_object ($ command )) {
388402 $ desc = 'A handler by ' . get_class ($ command );
389403 }
@@ -394,14 +408,14 @@ public function showCommandList($quit = true)
394408 // $this->output->write('There are all console controllers and independent commands.');
395409 $ this ->output ->mList ([
396410 //'There are all console controllers and independent commands.',
397- 'Usage: ' => "$ script [ route|command] [arg0 arg1=value1 arg2=value2 ...] [--opt -v -h ...] " ,
411+ 'Usage: ' => "$ script { route|command} [arg0 arg1=value1 arg2=value2 ...] [--opt -v -h ...] " ,
398412 'Group Commands: ' => $ controllerArr ?: '... No register any group command(controller) ' ,
399413 'Independent Commands: ' => $ commandArr ?: '... No register any independent command ' ,
400414 'Internal Commands: ' => $ internalCommands ,
401415 'Internal Options: ' => self ::$ internalOptions
402416 ]);
403417
404- $ this ->output ->write ("More please see : <cyan> $ script [controller| command] -h</cyan> " );
418+ $ this ->output ->write ("More command information, please use : <cyan> $ script { command} -h</cyan> " );
405419 $ quit && $ this ->stop ();
406420 }
407421
0 commit comments