Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit65a187f

Browse files
committed
[Console] Only show namespaces with commands
1 parent6f2ea67 commit65a187f

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

‎src/Symfony/Component/Console/Descriptor/TextDescriptor.php‎

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -201,19 +201,25 @@ protected function describeApplication(Application $application, array $options
201201
$commands =$description->getCommands();
202202

203203
foreach ($description->getNamespaces()as$namespace) {
204+
$namespace['commands'] =array_filter($namespace['commands'],function ($name)use ($commands) {
205+
returnisset($commands[$name]);
206+
});
207+
208+
if (empty($namespace['commands'])) {
209+
continue;
210+
}
211+
204212
if (!$describedNamespace && ApplicationDescription::GLOBAL_NAMESPACE !==$namespace['id']) {
205213
$this->writeText("\n");
206214
$this->writeText(' <comment>'.$namespace['id'].'</comment>',$options);
207215
}
208216

209217
foreach ($namespace['commands']as$name) {
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-
}
218+
$this->writeText("\n");
219+
$spacingWidth =$width -strlen($name);
220+
$command =$commands[$name];
221+
$commandAliases =$this->getCommandAliasesText($command);
222+
$this->writeText(sprintf(' <info>%s</info>%s%s',$name,str_repeat('',$spacingWidth),$commandAliases.$command->getDescription()),$options);
217223
}
218224
}
219225

@@ -234,9 +240,9 @@ private function writeText($content, array $options = array())
234240

235241
/**
236242
* Formats command aliases to show them in the command description.
237-
*
243+
*
238244
* @param Command $command
239-
*
245+
*
240246
* @return string
241247
*/
242248
privatefunctiongetCommandAliasesText($command)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp