Skip to content

Commit a2ab2c0

Browse files
[Console] enable describing commands in ways that make the list command lazy
1 parent f61b964 commit a2ab2c0

26 files changed

+86
-61
lines changed

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

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).

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:

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')
51+
->setDescription(self::$defaultDescription)
5152
->setHelp(<<<'EOF'
5253
The <info>%command.name%</info> command clears the given cache pools or cache pool clearers.
5354

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

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

Command/CachePoolPruneCommand.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
final class CachePoolPruneCommand extends Command
2626
{
2727
protected static $defaultName = 'cache:pool:prune';
28+
protected static $defaultDescription = 'Prunes cache pools';
2829

2930
private $pools;
3031

@@ -44,7 +45,7 @@ public function __construct(iterable $pools)
4445
protected function configure()
4546
{
4647
$this
47-
->setDescription('Prunes cache pools')
48+
->setDescription(self::$defaultDescription)
4849
->setHelp(<<<'EOF'
4950
The <info>%command.name%</info> command deletes all expired items from all pruneable pools.
5051

Command/CacheWarmupCommand.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
class CacheWarmupCommand extends Command
3030
{
3131
protected static $defaultName = 'cache:warmup';
32+
protected static $defaultDescription = 'Warms up an empty cache';
3233

3334
private $cacheWarmer;
3435

@@ -48,7 +49,7 @@ protected function configure()
4849
->setDefinition([
4950
new InputOption('no-optional-warmers', '', InputOption::VALUE_NONE, 'Skip optional cache warmers (faster)'),
5051
])
51-
->setDescription('Warms up an empty cache')
52+
->setDescription(self::$defaultDescription)
5253
->setHelp(<<<'EOF'
5354
The <info>%command.name%</info> command warms up the cache.
5455

Command/ConfigDebugCommand.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
class ConfigDebugCommand extends AbstractConfigCommand
3434
{
3535
protected static $defaultName = 'debug:config';
36+
protected static $defaultDescription = 'Dumps the current configuration for an extension';
3637

3738
/**
3839
* {@inheritdoc}
@@ -44,7 +45,7 @@ protected function configure()
4445
new InputArgument('name', InputArgument::OPTIONAL, 'The bundle name or the extension alias'),
4546
new InputArgument('path', InputArgument::OPTIONAL, 'The configuration option path'),
4647
])
47-
->setDescription('Dumps the current configuration for an extension')
48+
->setDescription(self::$defaultDescription)
4849
->setHelp(<<<'EOF'
4950
The <info>%command.name%</info> command dumps the current configuration for an
5051
extension/bundle.

Command/ConfigDumpReferenceCommand.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
class ConfigDumpReferenceCommand extends AbstractConfigCommand
3737
{
3838
protected static $defaultName = 'config:dump-reference';
39+
protected static $defaultDescription = 'Dumps the default configuration for an extension';
3940

4041
/**
4142
* {@inheritdoc}
@@ -48,7 +49,7 @@ protected function configure()
4849
new InputArgument('path', InputArgument::OPTIONAL, 'The configuration option path'),
4950
new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (yaml or xml)', 'yaml'),
5051
])
51-
->setDescription('Dumps the default configuration for an extension')
52+
->setDescription(self::$defaultDescription)
5253
->setHelp(<<<'EOF'
5354
The <info>%command.name%</info> command dumps the default configuration for an
5455
extension/bundle.

0 commit comments

Comments
 (0)