Permalink
Browse files

Updated the styles of the config parameters

  • Loading branch information...
javiereguiluz authored and fabpot committed Sep 28, 2015
1 parent bee1faa commit fdaa513cbb19604a9f4709541af9dde2db21aca1
@@ -13,7 +13,6 @@
use Symfony\Component\Config\Definition\ConfigurationInterface;
use Symfony\Component\Console\Helper\Table;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\StyleInterface;
use Symfony\Component\DependencyInjection\Extension\ExtensionInterface;
@@ -26,7 +25,7 @@
*/
abstract class AbstractConfigCommand extends ContainerDebugCommand
{
protected function listBundles(OutputInterface $output)
protected function listBundles($output)
{
$headers = array('Bundle name', 'Extension alias');
$rows = array();
@@ -35,12 +34,10 @@ protected function listBundles(OutputInterface $output)
$rows[] = array($bundle->getName(), $extension ? $extension->getAlias() : '');
}
$message = 'Available registered bundles with their extension alias if available:';
if ($output instanceof StyleInterface) {
$output->writeln(' '.$message);
$output->table($headers, $rows);
} else {
$output->writeln($message);
$output->writeln('Available registered bundles with their extension alias if available:');
$table = new Table($output);
$table->setHeaders($headers)->setRows($rows)->render($output);
}
@@ -66,6 +66,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
$name = $input->getArgument('name');
if (empty($name)) {
$output->comment('Provide the name of a bundle as the first argument of this command to dump its configuration.');
$output->newLine();
$this->listBundles($output);
return;
@@ -85,9 +87,9 @@ protected function execute(InputInterface $input, OutputInterface $output)
$config = $processor->processConfiguration($configuration, $configs);
if ($name === $extension->getAlias()) {
$output->writeln(sprintf('# Current configuration for extension with alias: "%s"', $name));
$output->title(sprintf('Current configuration for extension with alias "%s"', $name));
} else {
$output->writeln(sprintf('# Current configuration for "%s"', $name));
$output->title(sprintf('Current configuration for "%s"', $name));
}
$output->writeln(Yaml::dump(array($extension->getAlias() => $config), 3));
@@ -71,6 +71,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
$name = $input->getArgument('name');
if (empty($name)) {
$output->comment('Provide the name of a bundle as the first argument of this command to dump its default configuration.');
$output->newLine();
$this->listBundles($output);
return;

0 comments on commit fdaa513

Please sign in to comment.