Skip to content

[2.7][Console] consistent application help with 3.2 #20090

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Symfony/Component/Console/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ public function doRun(InputInterface $input, OutputInterface $output)
if (true === $input->hasParameterOption(array('--help', '-h'))) {
if (!$name) {
$name = 'help';
$input = new ArrayInput(array('command' => 'help'));
$input = new ArrayInput(array('command_name' => $this->defaultCommand));
} else {
$this->wantHelps = true;
}
Expand Down
34 changes: 16 additions & 18 deletions src/Symfony/Component/Console/Tests/Fixtures/application_run2.txt
Original file line number Diff line number Diff line change
@@ -1,29 +1,27 @@
Usage:
help [options] [--] [<command_name>]
list [options] [--] [<namespace>]

Arguments:
command The command to execute
command_name The command name [default: "help"]
namespace The namespace name

Options:
--xml To output help as XML
--format=FORMAT The output format (txt, xml, json, or md) [default: "txt"]
--raw To output raw command help
-h, --help Display this help message
-q, --quiet Do not output any message
-V, --version Display this application version
--ansi Force ANSI output
--no-ansi Disable ANSI output
-n, --no-interaction Do not ask any interactive question
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
--xml To output list as XML
--raw To output raw command list
--format=FORMAT The output format (txt, xml, json, or md) [default: "txt"]

Help:
The help command displays help for a given command:
The list command lists all commands:

php app/console help list
php app/console list

You can also output the help in other formats by using the --format option:
You can also display the commands for a specific namespace:

php app/console help --format=xml list
php app/console list test

To display the list of available commands, please use the list command.
You can also output the information in other formats by using the --format option:

php app/console list --format=xml

It's also possible to get raw list of commands (useful for embedding command runner):

php app/console list --raw