@@ -155,16 +155,29 @@ public function run($exit = true)
155
155
}
156
156
157
157
/**
158
+ * dispatch command
158
159
* @param string $command A command name
159
160
* @return int|mixed
160
161
*/
161
162
abstract protected function dispatch ($ command );
162
163
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
+
163
176
protected function afterRun ()
164
177
{
165
178
// display runtime info
166
179
if ($ this ->isDebug ()) {
167
- $ title = '------------ Runtime Stats -- ---------- ' ;
180
+ $ title = '---------- Runtime Stats(debug=true) ---------- ' ;
168
181
$ stats = $ this ->meta ['_stats ' ];
169
182
$ this ->meta ['_stats ' ] = Helper::runtime ($ stats ['startTime ' ], $ stats ['startMemory ' ], $ stats );
170
183
$ this ->output ->write ('' );
@@ -315,7 +328,7 @@ public function showHelpInfo($quit = true)
315
328
$ sep = $ this ->delimiter ;
316
329
317
330
$ 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 ...] " ,
319
332
'example ' => [
320
333
"$ script test (run a independent command) " ,
321
334
"$ script home {$ sep }index (run a command of the group) " ,
@@ -366,6 +379,7 @@ public function showCommandList($quit = true)
366
379
// all console controllers
367
380
$ controllers = $ this ->controllers ;
368
381
ksort ($ controllers );
382
+
369
383
foreach ($ controllers as $ name => $ controller ) {
370
384
/** @var AbstractCommand $controller */
371
385
$ controllerArr [$ name ] = $ controller ::getDescription () ?: $ desPlaceholder ;
@@ -383,7 +397,7 @@ public function showCommandList($quit = true)
383
397
} else if ($ msg = $ this ->getCommandMessage ($ name )) {
384
398
$ desc = $ msg ;
385
399
} else if (is_string ($ command )) {
386
- $ desc = 'A handler: ' . $ command ;
400
+ $ desc = 'A handler : ' . $ command ;
387
401
} else if (is_object ($ command )) {
388
402
$ desc = 'A handler by ' . get_class ($ command );
389
403
}
@@ -394,14 +408,14 @@ public function showCommandList($quit = true)
394
408
// $this->output->write('There are all console controllers and independent commands.');
395
409
$ this ->output ->mList ([
396
410
//'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 ...] " ,
398
412
'Group Commands: ' => $ controllerArr ?: '... No register any group command(controller) ' ,
399
413
'Independent Commands: ' => $ commandArr ?: '... No register any independent command ' ,
400
414
'Internal Commands: ' => $ internalCommands ,
401
415
'Internal Options: ' => self ::$ internalOptions
402
416
]);
403
417
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> " );
405
419
$ quit && $ this ->stop ();
406
420
}
407
421
0 commit comments