Skip to content

Commit 42d86cf

Browse files
committed
minor symfony#38397 [Console] Remove "php" invokation from help messages. (rodrigoaguilera)
This PR was merged into the 5.2-dev branch. Discussion ---------- [Console] Remove "php" invokation from help messages. | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | Deprecations? | no | License | MIT Discusstion started here: symfony#38349 I was a bit puzzled to find that the help for the list and help commands suggests that you call the console application by prefixing it with `php myconsoleapp`. As suggested in the PR above I am removing the `php ` prefix from the help. I am providing a script with a shebang like the first example suggested in the following link: https://symfony.com/doc/current/components/console.html Eventually I want to distribute my console app as docker image so there is no need for php installed or the users even knowing is written in php. The script name is easy to override by just setting a different value to `$_SERVER['PHP_SELF']` but this php prefix is hardcoded into the help strings for the the two default commands available. Slightly related to symfony#38347 as I am trying to improve the console help output. Commits ------- e036c30 [Console] Remove "php" invokation from help messages.
2 parents 8fa6b36 + e036c30 commit 42d86cf

14 files changed

+53
-52
lines changed

src/Symfony/Component/Console/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ CHANGELOG
1212
* Added `Application::getSignalRegistry()` and `Application::setSignalsToDispatchEvent()` methods
1313
* Added `SignalableCommandInterface` interface
1414
* Added `TableCellStyle` class to customize table cell
15+
* Removed `php ` prefix invocation from help messages.
1516

1617
5.1.0
1718
-----

src/Symfony/Component/Console/Command/HelpCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@ protected function configure()
4444
->setHelp(<<<'EOF'
4545
The <info>%command.name%</info> command displays help for a given command:
4646
47-
<info>php %command.full_name% list</info>
47+
<info>%command.full_name% list</info>
4848
4949
You can also output the help in other formats by using the <comment>--format</comment> option:
5050
51-
<info>php %command.full_name% --format=xml list</info>
51+
<info>%command.full_name% --format=xml list</info>
5252
5353
To display the list of available commands, please use the <info>list</info> command.
5454
EOF

src/Symfony/Component/Console/Command/ListCommand.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,19 +40,19 @@ protected function configure()
4040
->setHelp(<<<'EOF'
4141
The <info>%command.name%</info> command lists all commands:
4242
43-
<info>php %command.full_name%</info>
43+
<info>%command.full_name%</info>
4444
4545
You can also display the commands for a specific namespace:
4646
47-
<info>php %command.full_name% test</info>
47+
<info>%command.full_name% test</info>
4848
4949
You can also output the information in other formats by using the <comment>--format</comment> option:
5050
51-
<info>php %command.full_name% --format=xml</info>
51+
<info>%command.full_name% --format=xml</info>
5252
5353
It's also possible to get raw list of commands (useful for embedding command runner):
5454
55-
<info>php %command.full_name% --raw</info>
55+
<info>%command.full_name% --raw</info>
5656
EOF
5757
)
5858
;

src/Symfony/Component/Console/Tests/Command/CommandTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ public function testGetSetHelp()
153153
public function testGetProcessedHelp()
154154
{
155155
$command = new \TestCommand();
156-
$command->setHelp('The %command.name% command does... Example: php %command.full_name%.');
156+
$command->setHelp('The %command.name% command does... Example: %command.full_name%.');
157157
$this->assertStringContainsString('The namespace:name command does...', $command->getProcessedHelp(), '->getProcessedHelp() replaces %command.name% correctly');
158158
$this->assertStringNotContainsString('%command.full_name%', $command->getProcessedHelp(), '->getProcessedHelp() replaces %command.full_name%');
159159

@@ -162,7 +162,7 @@ public function testGetProcessedHelp()
162162
$this->assertStringContainsString('description', $command->getProcessedHelp(), '->getProcessedHelp() falls back to the description');
163163

164164
$command = new \TestCommand();
165-
$command->setHelp('The %command.name% command does... Example: php %command.full_name%.');
165+
$command->setHelp('The %command.name% command does... Example: %command.full_name%.');
166166
$application = new Application();
167167
$application->add($command);
168168
$application->setDefaultCommand('namespace:name', true);

src/Symfony/Component/Console/Tests/Fixtures/application_1.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"help [--format FORMAT] [--raw] [--] [<command_name>]"
88
],
99
"description": "Displays help for a command",
10-
"help": "The <info>help<\/info> command displays help for a given command:\n\n <info>php app\/console help list<\/info>\n\nYou can also output the help in other formats by using the <comment>--format<\/comment> option:\n\n <info>php app\/console help --format=xml list<\/info>\n\nTo display the list of available commands, please use the <info>list<\/info> command.",
10+
"help": "The <info>help<\/info> command displays help for a given command:\n\n <info>app\/console help list<\/info>\n\nYou can also output the help in other formats by using the <comment>--format<\/comment> option:\n\n <info>app\/console help --format=xml list<\/info>\n\nTo display the list of available commands, please use the <info>list<\/info> command.",
1111
"definition": {
1212
"arguments": {
1313
"command_name": {
@@ -110,7 +110,7 @@
110110
"list [--raw] [--format FORMAT] [--] [<namespace>]"
111111
],
112112
"description": "Lists commands",
113-
"help": "The <info>list<\/info> command lists all commands:\n\n <info>php app\/console list<\/info>\n\nYou can also display the commands for a specific namespace:\n\n <info>php app\/console list test<\/info>\n\nYou can also output the information in other formats by using the <comment>--format<\/comment> option:\n\n <info>php app\/console list --format=xml<\/info>\n\nIt's also possible to get raw list of commands (useful for embedding command runner):\n\n <info>php app\/console list --raw<\/info>",
113+
"help": "The <info>list<\/info> command lists all commands:\n\n <info>app\/console list<\/info>\n\nYou can also display the commands for a specific namespace:\n\n <info>app\/console list test<\/info>\n\nYou can also output the information in other formats by using the <comment>--format<\/comment> option:\n\n <info>app\/console list --format=xml<\/info>\n\nIt's also possible to get raw list of commands (useful for embedding command runner):\n\n <info>app\/console list --raw<\/info>",
114114
"definition": {
115115
"arguments": {
116116
"namespace": {

src/Symfony/Component/Console/Tests/Fixtures/application_1.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ Displays help for a command
1515

1616
The help command displays help for a given command:
1717

18-
php app/console help list
18+
app/console help list
1919

2020
You can also output the help in other formats by using the --format option:
2121

22-
php app/console help --format=xml list
22+
app/console help --format=xml list
2323

2424
To display the list of available commands, please use the list command.
2525

@@ -127,19 +127,19 @@ Lists commands
127127

128128
The list command lists all commands:
129129

130-
php app/console list
130+
app/console list
131131

132132
You can also display the commands for a specific namespace:
133133

134-
php app/console list test
134+
app/console list test
135135

136136
You can also output the information in other formats by using the --format option:
137137

138-
php app/console list --format=xml
138+
app/console list --format=xml
139139

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

142-
php app/console list --raw
142+
app/console list --raw
143143

144144
### Arguments
145145

src/Symfony/Component/Console/Tests/Fixtures/application_1.xml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
<description>Displays help for a command</description>
99
<help>The &lt;info&gt;help&lt;/info&gt; command displays help for a given command:
1010

11-
&lt;info&gt;php app/console help list&lt;/info&gt;
11+
&lt;info&gt;app/console help list&lt;/info&gt;
1212

1313
You can also output the help in other formats by using the &lt;comment&gt;--format&lt;/comment&gt; option:
1414

15-
&lt;info&gt;php app/console help --format=xml list&lt;/info&gt;
15+
&lt;info&gt;app/console help --format=xml list&lt;/info&gt;
1616

1717
To display the list of available commands, please use the &lt;info&gt;list&lt;/info&gt; command.</help>
1818
<arguments>
@@ -63,19 +63,19 @@
6363
<description>Lists commands</description>
6464
<help>The &lt;info&gt;list&lt;/info&gt; command lists all commands:
6565

66-
&lt;info&gt;php app/console list&lt;/info&gt;
66+
&lt;info&gt;app/console list&lt;/info&gt;
6767

6868
You can also display the commands for a specific namespace:
6969

70-
&lt;info&gt;php app/console list test&lt;/info&gt;
70+
&lt;info&gt;app/console list test&lt;/info&gt;
7171

7272
You can also output the information in other formats by using the &lt;comment&gt;--format&lt;/comment&gt; option:
7373

74-
&lt;info&gt;php app/console list --format=xml&lt;/info&gt;
74+
&lt;info&gt;app/console list --format=xml&lt;/info&gt;
7575

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

78-
&lt;info&gt;php app/console list --raw&lt;/info&gt;</help>
78+
&lt;info&gt;app/console list --raw&lt;/info&gt;</help>
7979
<arguments>
8080
<argument name="namespace" is_required="0" is_array="0">
8181
<description>The namespace name</description>

src/Symfony/Component/Console/Tests/Fixtures/application_2.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"help [--format FORMAT] [--raw] [--] [<command_name>]"
1212
],
1313
"description": "Displays help for a command",
14-
"help": "The <info>help<\/info> command displays help for a given command:\n\n <info>php app\/console help list<\/info>\n\nYou can also output the help in other formats by using the <comment>--format<\/comment> option:\n\n <info>php app\/console help --format=xml list<\/info>\n\nTo display the list of available commands, please use the <info>list<\/info> command.",
14+
"help": "The <info>help<\/info> command displays help for a given command:\n\n <info>app\/console help list<\/info>\n\nYou can also output the help in other formats by using the <comment>--format<\/comment> option:\n\n <info>app\/console help --format=xml list<\/info>\n\nTo display the list of available commands, please use the <info>list<\/info> command.",
1515
"definition": {
1616
"arguments": {
1717
"command_name": {
@@ -114,7 +114,7 @@
114114
"list [--raw] [--format FORMAT] [--] [<namespace>]"
115115
],
116116
"description": "Lists commands",
117-
"help": "The <info>list<\/info> command lists all commands:\n\n <info>php app\/console list<\/info>\n\nYou can also display the commands for a specific namespace:\n\n <info>php app\/console list test<\/info>\n\nYou can also output the information in other formats by using the <comment>--format<\/comment> option:\n\n <info>php app\/console list --format=xml<\/info>\n\nIt's also possible to get raw list of commands (useful for embedding command runner):\n\n <info>php app\/console list --raw<\/info>",
117+
"help": "The <info>list<\/info> command lists all commands:\n\n <info>app\/console list<\/info>\n\nYou can also display the commands for a specific namespace:\n\n <info>app\/console list test<\/info>\n\nYou can also output the information in other formats by using the <comment>--format<\/comment> option:\n\n <info>app\/console list --format=xml<\/info>\n\nIt's also possible to get raw list of commands (useful for embedding command runner):\n\n <info>app\/console list --raw<\/info>",
118118
"definition": {
119119
"arguments": {
120120
"namespace": {

src/Symfony/Component/Console/Tests/Fixtures/application_2.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ Displays help for a command
2828

2929
The help command displays help for a given command:
3030

31-
php app/console help list
31+
app/console help list
3232

3333
You can also output the help in other formats by using the --format option:
3434

35-
php app/console help --format=xml list
35+
app/console help --format=xml list
3636

3737
To display the list of available commands, please use the list command.
3838

@@ -140,19 +140,19 @@ Lists commands
140140

141141
The list command lists all commands:
142142

143-
php app/console list
143+
app/console list
144144

145145
You can also display the commands for a specific namespace:
146146

147-
php app/console list test
147+
app/console list test
148148

149149
You can also output the information in other formats by using the --format option:
150150

151-
php app/console list --format=xml
151+
app/console list --format=xml
152152

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

155-
php app/console list --raw
155+
app/console list --raw
156156

157157
### Arguments
158158

src/Symfony/Component/Console/Tests/Fixtures/application_2.xml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
<description>Displays help for a command</description>
99
<help>The &lt;info&gt;help&lt;/info&gt; command displays help for a given command:
1010

11-
&lt;info&gt;php app/console help list&lt;/info&gt;
11+
&lt;info&gt;app/console help list&lt;/info&gt;
1212

1313
You can also output the help in other formats by using the &lt;comment&gt;--format&lt;/comment&gt; option:
1414

15-
&lt;info&gt;php app/console help --format=xml list&lt;/info&gt;
15+
&lt;info&gt;app/console help --format=xml list&lt;/info&gt;
1616

1717
To display the list of available commands, please use the &lt;info&gt;list&lt;/info&gt; command.</help>
1818
<arguments>
@@ -63,19 +63,19 @@
6363
<description>Lists commands</description>
6464
<help>The &lt;info&gt;list&lt;/info&gt; command lists all commands:
6565

66-
&lt;info&gt;php app/console list&lt;/info&gt;
66+
&lt;info&gt;app/console list&lt;/info&gt;
6767

6868
You can also display the commands for a specific namespace:
6969

70-
&lt;info&gt;php app/console list test&lt;/info&gt;
70+
&lt;info&gt;app/console list test&lt;/info&gt;
7171

7272
You can also output the information in other formats by using the &lt;comment&gt;--format&lt;/comment&gt; option:
7373

74-
&lt;info&gt;php app/console list --format=xml&lt;/info&gt;
74+
&lt;info&gt;app/console list --format=xml&lt;/info&gt;
7575

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

78-
&lt;info&gt;php app/console list --raw&lt;/info&gt;</help>
78+
&lt;info&gt;app/console list --raw&lt;/info&gt;</help>
7979
<arguments>
8080
<argument name="namespace" is_required="0" is_array="0">
8181
<description>The namespace name</description>

0 commit comments

Comments
 (0)