Skip to content

Commit b152151

Browse files
committed
[FrameworkBundle] Use SymfonyStyle in AbstractConfigCommand
1 parent e1ba8cc commit b152151

File tree

3 files changed

+9
-11
lines changed

3 files changed

+9
-11
lines changed

Command/AbstractConfigCommand.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ abstract class AbstractConfigCommand extends ContainerDebugCommand
2727
{
2828
protected function listBundles($output)
2929
{
30+
$title = 'Available registered bundles with their extension alias if available';
3031
$headers = array('Bundle name', 'Extension alias');
3132
$rows = array();
3233

@@ -41,9 +42,10 @@ protected function listBundles($output)
4142
}
4243

4344
if ($output instanceof StyleInterface) {
45+
$output->title($title);
4446
$output->table($headers, $rows);
4547
} else {
46-
$output->writeln('Available registered bundles with their extension alias if available:');
48+
$output->writeln($title);
4749
$table = new Table($output);
4850
$table->setHeaders($headers)->setRows($rows)->render($output);
4951
}

Command/ConfigDebugCommand.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,10 @@ protected function configure()
5656
protected function execute(InputInterface $input, OutputInterface $output)
5757
{
5858
$io = new SymfonyStyle($input, $output);
59-
$name = $input->getArgument('name');
6059

61-
if (empty($name)) {
62-
$io->comment('Provide the name of a bundle as the first argument of this command to dump its configuration.');
63-
$io->newLine();
64-
$this->listBundles($output);
60+
if (null === $name = $input->getArgument('name')) {
61+
$this->listBundles($io);
62+
$io->comment('Provide the name of a bundle as the first argument of this command to dump its configuration. (e.g. <comment>debug:config FrameworkBundle</comment>)');
6563

6664
return;
6765
}

Command/ConfigDumpReferenceCommand.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,10 @@ protected function configure()
6868
protected function execute(InputInterface $input, OutputInterface $output)
6969
{
7070
$io = new SymfonyStyle($input, $output);
71-
$name = $input->getArgument('name');
7271

73-
if (empty($name)) {
74-
$io->comment('Provide the name of a bundle as the first argument of this command to dump its default configuration.');
75-
$io->newLine();
76-
$this->listBundles($output);
72+
if (null === $name = $input->getArgument('name')) {
73+
$this->listBundles($io);
74+
$io->comment('Provide the name of a bundle as the first argument of this command to dump its default configuration. (e.g. <comment>config:dump-reference FrameworkBundle</comment>)');
7775

7876
return;
7977
}

0 commit comments

Comments
 (0)