8000 [Console] enable describing commands in ways that make the `list` com… · christingruber/symfony@8a1a1b8 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8a1a1b8

Browse files
[Console] enable describing commands in ways that make the list command lazy
1 parent 28533aa commit 8a1a1b8

File tree

51 files changed

+463
-90
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+463
-90
lines changed

src/Symfony/Bridge/Monolog/Command/ServerLogCommand.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ class ServerLogCommand extends Command
3434
private $handler;
3535

3636
protected static $defaultName = 'server:log';
37+
protected static $defaultDescription = 'Starts a log server that displays logs in real time';
3738

3839
public function isEnabled()
3940
{
@@ -60,7 +61,7 @@ protected function configure()
6061
->addOption('format', null, InputOption::VALUE_REQUIRED, 'The line format', ConsoleFormatter::SIMPLE_FORMAT)
6162
->addOption('date-format', null, InputOption::VALUE_REQUIRED, 'The date format', ConsoleFormatter::SIMPLE_DATE)
6263
->addOption('filter', null, InputOption::VALUE_REQUIRED, 'An expression to filter log. Example: "level > 200 or channel in [\'app\', \'doctrine\']"')
63-
->setDescription('Starts a log server that displays logs in real time')
64+
->setDescription(self::$defaultDescription)
6465
->setHelp(<<<'EOF'
6566
<info>%command.name%</info> starts a log server to display in real time the log
6667
messages generated by your application:

src/Symfony/Bridge/Twig/Command/DebugCommand.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
class DebugCommand extends Command
3434
{
3535
protected static $defaultName = 'debug:twig';
36+
protected static $defaultDescription = 'Shows a list of twig functions, filters, globals and tests';
3637

3738
private $twig;
3839
private $projectDir;
@@ -60,7 +61,7 @@ protected function configure()
6061
new InputOption('filter', null, InputOption::VALUE_REQUIRED, 'Show details for all entries matching this filter'),
6162
new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (text or json)', 'text'),
6263
])
63-
->setDescription('Shows a list of twig functions, filters, globals and tests')
64+
->setDescription(self::$defaultDescription)
6465
->setHelp(<<<'EOF'
6566
The <info>%command.name%</info> command outputs a list of twig functions,
6667
filters, globals and tests.

src/Symfony/Bridge/Twig/Command/LintCommand.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
class LintCommand extends Command
3636
{
3737
protected static $defaultName = 'lint:twig';
38+
protected static $defaultDescription = 'Lints a template and outputs encountered errors';
3839

3940
private $twig;
4041

@@ -48,7 +49,7 @@ public function __construct(Environment $twig)
4849
protected function configure()
4950
{
5051
$this
51-
->setDescription('Lints a template and outputs encountered errors')
52+
->setDescription(self::$defaultDescription)
5253
->addOption('format', null, InputOption::VALUE_REQUIRED, 'The output format', 'txt')
5354
->addOption('show-deprecations', null, InputOption::VALUE_NONE, 'Show deprecations as errors')
5455
->addArgument('filename', InputArgument::IS_ARRAY, 'A file, a directory or "-" for reading from STDIN')

src/Symfony/Bundle/DebugBundle/Resources/config/services.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111

1212
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
1313

14+
use Monolog\Formatter\FormatterInterface;
1415
use Symfony\Bridge\Monolog\Command\ServerLogCommand;
16+
use Symfony\Bridge\Monolog\Formatter\ConsoleFormatter;
1517
use Symfony\Bridge\Twig\Extension\DumpExtension;
1618
use Symfony\Component\HttpKernel\DataCollector\DumpDataCollector;
1719
use Symfony\Component\HttpKernel\EventListener\DumpListener;
@@ -127,9 +129,12 @@
127129
'html' => inline_service(HtmlDescriptor::class)->args([service('var_dumper.html_dumper')]),
128130
],
129131
])
130-
->tag('console.command', ['command' => 'server:dump'])
132+
->tag('console.command')
131133

132134
->set('monolog.command.server_log', ServerLogCommand::class)
133-
F438 ->tag('console.command', ['command' => 'server:log'])
134135
;
136+
137+
if (class_exists(ConsoleFormatter::class) && interface_exists(FormatterInterface::class)) {
138+
$container->services()->get('monolog.command.server_log')->tag('console.command');
139+
}
135140
};

src/Symfony/Bundle/FrameworkBundle/Command/AboutCommand.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,15 @@
3030
class AboutCommand extends Command
3131
{
3232
protected static $defaultName = 'about';
33+
protected static $defaultDescription = 'Displays information about the current project';
3334

3435
/**
3536
* {@inheritdoc}
3637
*/
3738
protected function configure()
3839
{
3940
$this
40-
->setDescription('Displays information about the current project')
41+
->setDescription(self::$defaultDescription)
4142
->setHelp(<<<'EOT'
4243
The <info>%command.name%</info> command displays information about the current Symfony project.
4344

src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ class AssetsInstallCommand extends Command
4040
public const METHOD_RELATIVE_SYMLINK = 'relative symlink';
4141

4242
protected static $defaultName = 'assets:install';
43+
protected static $defaultDescription = 'Installs bundles web assets under a public directory';
4344

4445
private $filesystem;
4546
private $projectDir;
@@ -64,7 +65,7 @@ protected function configure()
6465
->addOption('symlink', null, InputOption::VALUE_NONE, 'Symlinks the assets instead of copying it')
6566
->addOption('relative', null, InputOption::VALUE_NONE, 'Make relative symlinks')
6667
->addOption('no-cleanup', null, InputOption::VALUE_NONE, 'Do not remove the assets of the bundles that no longer exist')
67-
->setDescription('Installs bundles web assets under a public directory')
68+
->setDescription(self::$defaultDescription)
6869
->setHelp(<<<'EOT'
6970
The <info>%command.name%</info> command installs bundle assets into a given
7071
directory (e.g. the <comment>public</comment> directory).

src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
class CacheClearCommand extends Command
3737
{
3838
protected static $defaultName = 'cache:clear';
39+
protected static $defaultDescription = 'Clears the cache';
3940

4041
private $cacheClearer;
4142
private $filesystem;
@@ -58,7 +59,7 @@ protected function configure()
5859
new InputOption('no-warmup', '', InputOption::VALUE_NONE, 'Do not warm up the cache'),
5960
new InputOption('no-optional-warmers', '', InputOption::VALUE_NONE, 'Skip optional cache warmers (faster)'),
6061
])
61-
->setDescription('Clears the cache')
62+
->setDescription(self::$defaultDescription)
6263
->setHelp(<<<'EOF'
6364
The <info>%command.name%</info> command clears the application cache for a given environment
6465
and debug mode:

src/Symfony/Bundle/FrameworkBundle/Command/CachePoolClearCommand.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
final class CachePoolClearCommand extends Command
2929
{
3030
protected static $defaultName = 'cache:pool:clear';
31+
protected static $defaultDescription = 'Clears cache pools';
3132

3233
private $poolClearer;
3334

@@ -47,7 +48,7 @@ protected function configure()
4748
->setDefinition([
4849
new InputArgument('pools', InputArgument::IS_ARRAY | InputArgument::REQUIRED, 'A list of cache pools or cache pool clearers'),
4950
])
50-
->setDescription('Clears cache pools'< 10000 /span>)
51+
->setDescription(self::$defaultDescription)
5152
->setHelp(<<<'EOF'
5253
The <info>%command.name%</info> command clears the given cache pools or cache pool clearers.
5354

src/Symfony/Bundle/FrameworkBundle/Command/CachePoolDeleteCommand.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
final class CachePoolDeleteCommand extends Command
2727
{
2828
protected static $defaultName = 'cache:pool:delete';
29+
protected static $defaultDescription = 'Deletes an item from a cache pool';
2930

3031
private $poolClearer;
3132

@@ -46,7 +47,7 @@ protected function configure()
4647
new InputArgument('pool', InputArgument::REQUIRED, 'The cache pool from which to delete an item'),
4748
new InputArgument('key', InputArgument::REQUIRED, 'The cache key to delete from the pool'),
4849
])
49-
->setDescription('Deletes an item from a cache pool')
50+
->setDescription(self::$defaultDescription)
5051
->setHelp(<<<'EOF'
5152
The <info>%command.name%</info> deletes an item from a given cache pool.
5253

src/Symfony/Bundle/FrameworkBundle/Command/CachePoolListCommand.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
final class CachePoolListCommand extends Command
2525
{
2626
protected static $defaultName = 'cache:pool:list';
27+
protected static $defaultDescription = 'List available cache pools';
2728

2829
private $poolNames;
2930

@@ -40,7 +41,7 @@ public function __construct(array $poolNames)
4041
protected function configure()
4142
{
4243
$this
43-
->setDescription('List available cache pools')
44+
->setDescription(self::$defaultDescription)
4445
->setHelp(<<<'EOF'
4546
The <info>%command.name%</info> command lists all available cache pools.
4647
EOF

0 commit comments

Comments
 (0)
0