Skip to content

Commit

Permalink
Updated the styles of the config parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
javiereguiluz authored and fabpot committed Oct 1, 2015
1 parent bee1faa commit fdaa513
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
Expand Up @@ -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;

Expand All @@ -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();
Expand All @@ -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);
}
Expand Down
Expand Up @@ -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;
Expand All @@ -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));
Expand Down
Expand Up @@ -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;
Expand Down

0 comments on commit fdaa513

Please sign in to comment.