Skip to content

Commit

Permalink
[list] Show global namespace commands. (hechoendrupal#141)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmolivas committed Jan 23, 2017
1 parent ecec2d4 commit 0272081
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions src/Descriptor/TextDescriptor.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,16 +188,33 @@ protected function describeApplication(Application $application, array $options
else {
$this->writeText($application->trans('commands.list.messages.available-commands'), $options);
}

$singleCommands = [
'about',
'chain',
'check',
'exec',
'help',
'init',
'list',
'shell',
'server'
];

// add commands by namespace
foreach ($description->getNamespaces() as $namespace) {
if (ApplicationDescription::GLOBAL_NAMESPACE == $namespace['id']){
continue;
}
if (!$describedNamespace && ApplicationDescription::GLOBAL_NAMESPACE !== $namespace['id']) {
$this->writeText("\n");
$this->writeText(' <comment>'.$namespace['id'].'</comment>', $options);
}
foreach ($namespace['commands'] as $name) {

if (ApplicationDescription::GLOBAL_NAMESPACE == $namespace['id']){
if (!in_array($name, $singleCommands)) {
continue;
}
}

$this->writeText("\n");
$alias = '';
if ($description->getCommand($name)->getAliases()){
Expand Down

0 comments on commit 0272081

Please sign in to comment.