@@ -198,16 +198,22 @@ protected function describeApplication(Application $application, array $options
198
198
}
199
199
200
200
// add commands by namespace
201
+ $ commands = $ description ->getCommands ();
202
+
201
203
foreach ($ description ->getNamespaces () as $ namespace ) {
202
204
if (!$ describedNamespace && ApplicationDescription::GLOBAL_NAMESPACE !== $ namespace ['id ' ]) {
203
205
$ this ->writeText ("\n" );
204
206
$ this ->writeText (' <comment> ' .$ namespace ['id ' ].'</comment> ' , $ options );
205
207
}
206
208
207
209
foreach ($ namespace ['commands ' ] as $ name ) {
208
- $ this ->writeText ("\n" );
209
- $ spacingWidth = $ width - strlen ($ name );
210
- $ this ->writeText (sprintf (' <info>%s</info>%s%s ' , $ name , str_repeat (' ' , $ spacingWidth ), $ description ->getCommand ($ name )->getDescription ()), $ options );
210
+ if (isset ($ commands [$ name ])) {
211
+ $ this ->writeText ("\n" );
212
+ $ spacingWidth = $ width - strlen ($ name );
213
+ $ command = $ commands [$ name ];
214
+ $ commandAliases = $ this ->getCommandAliasesText ($ command );
215
+ $ this ->writeText (sprintf (' <info>%s</info>%s%s ' , $ name , str_repeat (' ' , $ spacingWidth ), $ commandAliases .$ command ->getDescription ()), $ options );
216
+ }
211
217
}
212
218
}
213
219
@@ -226,6 +232,25 @@ private function writeText($content, array $options = array())
226
232
);
227
233
}
228
234
235
+ /**
236
+ * Formats command aliases to show them in the command description.
237
+ *
238
+ * @param Command $command
239
+ *
240
+ * @return string
241
+ */
242
+ private function getCommandAliasesText ($ command )
243
+ {
244
+ $ text = '' ;
245
+ $ aliases = $ command ->getAliases ();
246
+
247
+ if ($ aliases ) {
248
+ $ text = '[ ' .implode ('| ' , $ aliases ).'] ' ;
249
+ }
250
+
251
+ return $ text ;
252
+ }
253
+
229
254
/**
230
255
* Formats input option/argument default value.
231
256
*
0 commit comments