@@ -148,8 +148,6 @@ final protected function showCommandList()
148148 $ ref = new \ReflectionClass ($ this );
149149 $ sName = lcfirst (self ::getName () ?: $ ref ->getShortName ());
150150
151- // $this->write(sprintf("This is in the console controller [<bold>%s</bold>]\n", $class = $ref->getName();));
152-
153151 if (!($ classDes = self ::getDescription ())) {
154152 $ classDes = Annotation::description ($ ref ->getDocComment ()) ?: 'No Description for the console controller ' ;
155153 }
@@ -182,25 +180,37 @@ final protected function showCommandList()
182180 }
183181 }
184182
183+ // sort commands
184+ ksort ($ commands );
185+
186+ // move 'help' to last.
187+ if ($ helpCmd = $ commands ['help ' ] ?? null ) {
188+ unset($ commands ['help ' ]);
189+ $ commands ['help ' ] = $ helpCmd ;
190+ }
191+
192+ $ script = $ this ->getScriptName ();
193+
185194 if ($ this ->standAlone ) {
186195 $ name = $ sName . ' ' ;
187- $ usage = ' <info>{command}</info> [arguments] [options] ' ;
196+ $ usage = " $ script <info>{command}</info> [arguments] [options]" ;
188197 } else {
189198 $ name = $ sName . $ this ->delimiter ;
190- $ usage = "<info> {$ name }</ info>{command} [arguments] [options] " ;
199+ $ usage = "$ script {$ name }<info>{command}</info> [arguments] [options] " ;
191200 }
192201
193- $ script = $ this ->getScriptName ();
194202 $ this ->output ->mList ([
195203 'Description: ' => $ classDes ,
196204 'Usage: ' => $ usage ,
197205 //'Group Name:' => "<info>$sName</info>",
198206 'Commands: ' => $ commands ,
199207 'Options: ' => [
200208 '-h,--help ' => 'Show help of the command group or specified command action ' ,
201- $ this ->showMore ? "\nMore information please use: <cyan> $ script {$ name }{command} -h</cyan> " : ''
209+ // $this->showMore ? "\nMore information please use: <cyan>$script {$name}{command} -h</cyan>" : ''
202210 ],
203211 ]);
212+
213+ $ this ->showMore && $ this ->write ("More information please use: <cyan> $ script {$ name }{command} -h</cyan> " );
204214 }
205215
206216 /**
0 commit comments