Skip to content

Commit

Permalink
replaced command names with supported placeholders in help texts
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobion committed Mar 21, 2012
1 parent 69fc07a commit 304e13d
Show file tree
Hide file tree
Showing 20 changed files with 89 additions and 174 deletions.
Expand Up @@ -31,33 +31,33 @@ class AssetsInstallCommand extends ContainerAwareCommand
protected function configure()
{
$this
->setName('assets:install')
->setDefinition(array(
new InputArgument('target', InputArgument::REQUIRED, 'The target directory (usually "web")'),
))
->addOption('symlink', null, InputOption::VALUE_NONE, 'Symlinks the assets instead of copying it')
->addOption('relative', null, InputOption::VALUE_NONE, 'Make relative symlinks')
->setDescription('Installs bundles web assets under a public web directory')
->setHelp(<<<EOT
The <info>assets:install</info> command installs bundle assets into a given
The <info>%command.name%</info> command installs bundle assets into a given
directory (e.g. the web directory).
<info>php app/console assets:install web</info>
<info>php %command.full_name% web</info>
A "bundles" directory will be created inside the target directory, and the
"Resources/public" directory of each bundle will be copied into it.
To create a symlink to each bundle instead of copying its assets, use the
<info>--symlink</info> option:
<info>php app/console assets:install web --symlink</info>
<info>php %command.full_name% web --symlink</info>
To make symlink relative, add the <info>--relative</info> option:
<info>php app/console assets:install web --symlink --relative</info>
<info>php %command.full_name% web --symlink --relative</info>
EOT
)
->setName('assets:install')
;
}

Expand Down
Expand Up @@ -40,11 +40,11 @@ protected function configure()
))
->setDescription('Clears the cache')
->setHelp(<<<EOF
The <info>cache:clear</info> command clears the application cache for a given environment
The <info>%command.name%</info> command clears the application cache for a given environment
and debug mode:
<info>php app/console cache:clear --env=dev</info>
<info>php app/console cache:clear --env=prod --no-debug</info>
<info>php %command.full_name% --env=dev</info>
<info>php %command.full_name% --env=prod --no-debug</info>
EOF
)
;
Expand Down
Expand Up @@ -34,7 +34,7 @@ protected function configure()
))
->setDescription('Warms up an empty cache')
->setHelp(<<<EOF
The <info>cache:warmup</info> command warms up the cache.
The <info>%command.name%</info> command warms up the cache.
Before running this command, the cache must be empty.
EOF
Expand Down
Expand Up @@ -33,24 +33,23 @@ class ConfigDumpReferenceCommand extends ContainerDebugCommand
protected function configure()
{
$this
->setName('config:dump-reference')
->setDefinition(array(
new InputArgument('name', InputArgument::REQUIRED, 'The Bundle or extension alias')
))
->setName('config:dump-reference')
->setDescription('Dumps default configuration for an extension.')
->setDescription('Dumps default configuration for an extension')
->setHelp(<<<EOF
The <info>config:dump-reference</info> command dumps the default configuration for an extension/bundle.
The <info>%command.name%</info> command dumps the default configuration for an extension/bundle.
The extension alias or bundle name can be used:
Example:
<info>%command.name% framework</info>
<info>php %command.full_name% framework</info>
or
<info>%command.name% FrameworkBundle</info>
<info>php %command.full_name% FrameworkBundle</info>
EOF
)
;
Expand Down
Expand Up @@ -40,25 +40,25 @@ class ContainerDebugCommand extends ContainerAwareCommand
protected function configure()
{
$this
->setName('container:debug')
->setDefinition(array(
new InputArgument('name', InputArgument::OPTIONAL, 'A service name (foo)'),
new InputOption('show-private', null, InputOption::VALUE_NONE, 'Use to show public *and* private services'),
))
->setName('container:debug')
->setDescription('Displays current services for an application')
->setHelp(<<<EOF
The <info>container:debug</info> command displays all configured <comment>public</comment> services:
The <info>%command.name%</info> command displays all configured <comment>public</comment> services:
<info>container:debug</info>
<info>php %command.full_name%</info>
To get specific information about a service, specify its name:
<info>container:debug validator</info>
<info>php %command.full_name% validator</info>
By default, private services are hidden. You can display all services by
using the --show-private flag:
<info>container:debug --show-private</info>
<info>php %command.full_name% --show-private</info>
EOF
)
;
Expand Down
Expand Up @@ -47,18 +47,18 @@ public function isEnabled()
protected function configure()
{
$this
->setName('router:dump-apache')
->setDefinition(array(
new InputArgument('script_name', InputArgument::OPTIONAL, 'The script name of the application\'s front controller.'),
new InputOption('base-uri', null, InputOption::VALUE_REQUIRED, 'The base URI'),
))
->setName('router:dump-apache')
->setDescription('Dumps all routes as Apache rewrite rules')
->setHelp(<<<EOF
The <info>router:dump-apache</info> dumps all routes as Apache rewrite rules.
The <info>%command.name%</info> dumps all routes as Apache rewrite rules.
These can then be used with the ApacheUrlMatcher to use Apache for route
matching.
<info>router:dump-apache</info>
<info>php %command.full_name%</info>
EOF
)
;
Expand Down
Expand Up @@ -46,15 +46,15 @@ public function isEnabled()
protected function configure()
{
$this
->setName('router:debug')
->setDefinition(array(
new InputArgument('name', InputArgument::OPTIONAL, 'A route name'),
))
->setName('router:debug')
->setDescription('Displays current routes for an application')
->setHelp(<<<EOF
The <info>router:debug</info> displays the configured routes:
The <info>%command.name%</info> displays the configured routes:
<info>router:debug</info>
<info>php %command.full_name%</info>
EOF
)
;
Expand Down
Expand Up @@ -46,15 +46,15 @@ public function isEnabled()
protected function configure()
{
$this
->setName('router:match')
->setDefinition(array(
new InputArgument('path_info', InputArgument::REQUIRED, 'A path info'),
))
->setName('router:match')
->setDescription('Helps debug routes by simulating a path info match')
->setHelp(<<<EOF
The <info>router:match</info> simulates a path info match:
The <info>%command.name%</info> simulates a path info match:
<info>router:match /foo</info>
<info>php %command.full_name% /foo</info>
EOF
)
;
Expand Down
Expand Up @@ -40,7 +40,6 @@ protected function configure()
{
$this
->setName('translation:update')
->setDescription('Update the translation file')
->setDefinition(array(
new InputArgument('locale', InputArgument::REQUIRED, 'The locale'),
new InputArgument('bundle', InputArgument::REQUIRED, 'The bundle where to load the messages'),
Expand All @@ -61,16 +60,18 @@ protected function configure()
'Should the update be done'
)
))
->setDescription('Update the translation file')
->setHelp(<<<EOF
The <info>translation:update</info> command extract translation strings from templates
The <info>%command.name%</info> command extract translation strings from templates
of a given bundle. It can display them or merge the new ones into the translation files.
When new translation strings are found it can automatically add a prefix to the translation
message.
<info>php app/console translation:update --dump-messages en AcmeBundle</info>
<info>php app/console translation:update --force --prefix="new_" fr AcmeBundle</info>
<info>php %command.full_name% --dump-messages en AcmeBundle</info>
<info>php %command.full_name% --force --prefix="new_" fr AcmeBundle</info>
EOF
);
)
;
}

/**
Expand Down
11 changes: 6 additions & 5 deletions src/Symfony/Bundle/SecurityBundle/Command/InitAclCommand.php
Expand Up @@ -32,18 +32,19 @@ protected function configure()
$this
->setName('init:acl')
->setDescription('Mounts ACL tables in the database')
->setHelp(<<<EOT
The <info>init:acl</info> command mounts ACL tables in the database.
->setHelp(<<<EOF
The <info>%command.name%</info> command mounts ACL tables in the database.
<info>php app/console init:acl</info>
<info>php %command.full_name%</info>
The name of the DBAL connection must be configured in your <info>app/config/security.yml</info> configuration file in the <info>security.acl.connection</info> variable.
<info>security:
acl:
connection: default</info>
EOT
);
EOF
)
;
}

/**
Expand Down
11 changes: 6 additions & 5 deletions src/Symfony/Component/Console/Command/HelpCommand.php
Expand Up @@ -35,22 +35,23 @@ protected function configure()
$this->ignoreValidationErrors();

$this
->setName('help')
->setDefinition(array(
new InputArgument('command_name', InputArgument::OPTIONAL, 'The command name', 'help'),
new InputOption('xml', null, InputOption::VALUE_NONE, 'To output help as XML'),
))
->setName('help')
->setDescription('Displays help for a command')
->setHelp(<<<EOF
The <info>help</info> command displays help for a given command:
The <info>%command.name%</info> command displays help for a given command:
<info>php app/console help list</info>
<info>php %command.full_name% list</info>
You can also output the help as XML by using the <comment>--xml</comment> option:
<info>php app/console help --xml list</info>
<info>php %command.full_name% --xml list</info>
EOF
);
)
;
}

/**
Expand Down
15 changes: 8 additions & 7 deletions src/Symfony/Component/Console/Command/ListCommand.php
Expand Up @@ -32,27 +32,28 @@ class ListCommand extends Command
protected function configure()
{
$this
->setDefinition($this->createDefinition())
->setName('list')
->setDefinition($this->createDefinition())
->setDescription('Lists commands')
->setHelp(<<<EOF
The <info>list</info> command lists all commands:
The <info>%command.name%</info> command lists all commands:
<info>php app/console list</info>
<info>php %command.full_name%</info>
You can also display the commands for a specific namespace:
<info>php app/console list test</info>
<info>php %command.full_name% test</info>
You can also output the information as XML by using the <comment>--xml</comment> option:
<info>php app/console list --xml</info>
<info>php %command.full_name% --xml</info>
It's also possible to get raw list of commands (useful for embedding command runner):
<info>php app/console list --raw</info>
<info>php %command.full_name% --raw</info>
EOF
);
)
;
}

/**
Expand Down
6 changes: 1 addition & 5 deletions src/Symfony/Component/Console/Output/Output.php
Expand Up @@ -43,12 +43,8 @@ abstract class Output implements OutputInterface
*/
public function __construct($verbosity = self::VERBOSITY_NORMAL, $decorated = null, OutputFormatterInterface $formatter = null)
{
if (null === $formatter) {
$formatter = new OutputFormatter();
}

$this->verbosity = null === $verbosity ? self::VERBOSITY_NORMAL : $verbosity;
$this->formatter = $formatter;
$this->formatter = null === $formatter ? new OutputFormatter() : $formatter;
$this->formatter->setDecorated((Boolean) $decorated);
}

Expand Down
2 changes: 2 additions & 0 deletions src/Symfony/Component/Console/Tester/ApplicationTester.php
Expand Up @@ -13,6 +13,8 @@

use Symfony\Component\Console\Application;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Output\StreamOutput;

/**
Expand Down

0 comments on commit 304e13d

Please sign in to comment.