minor #15980 Updated the styles of the config parameters (javiereguiluz)
This PR was squashed before being merged into the 2.8 branch (closes #15980).
Discussion
----------
Updated the styles of the config parameters
| Q | A
| ------------- | ---
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
This PR uses comment() which hasn't been merged yet. WIP PR at #15964
**I have a question**: is it mandatory that the output of this command is a valid YAML or XML file? If not, we can keep the changes in the title of the command. Otherwise, I'll revert those changes.
![config_1](https://cloud.githubusercontent.com/assets/73419/10144197/9018a138-661c-11e5-8c9d-dc1b721533b8.png)
![config_2](https://cloud.githubusercontent.com/assets/73419/10144199/925e5604-661c-11e5-8597-8e01013c2e86.png)
Commits
-------
fdaa513
Updated the styles of the config parameters
This commit is contained in:
commit
56fa973514
@ -13,7 +13,6 @@ namespace Symfony\Bundle\FrameworkBundle\Command;
|
||||
|
||||
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 @@ use Symfony\Component\DependencyInjection\Extension\ExtensionInterface;
|
||||
*/
|
||||
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 @@ abstract class AbstractConfigCommand extends ContainerDebugCommand
|
||||
$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 @@ EOF
|
||||
$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 @@ EOF
|
||||
$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 @@ EOF
|
||||
$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;
|
||||
|
Reference in New Issue
Block a user