Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 330cf8d

Browse filesBrowse files
committed
feature #26439 [Console] [DX] Fix command description/help display (noniagriconomie)
This PR was submitted for the 2.7 branch but it was merged into the 4.1-dev branch instead (closes #26439). Discussion ---------- [Console] [DX] Fix command description/help display | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #26376 | License | MIT | Doc PR | none Hi, Here is a fix for the issue #26376 I only patch the text descriptor, should I do it for others? (I do not think so as the main and default one is text) Thanks Commits ------- 9ca6d62 Fix command description display
2 parents e0f79f6 + 9ca6d62 commit 330cf8d
Copy full SHA for 330cf8d

File tree

7 files changed

+27
-1
lines changed
Filter options

7 files changed

+27
-1
lines changed

‎src/Symfony/Component/Console/Descriptor/TextDescriptor.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/Descriptor/TextDescriptor.php
+9-1Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,13 @@ protected function describeCommand(Command $command, array $options = array())
140140
$command->getSynopsis(false);
141141
$command->mergeApplicationDefinition(false);
142142

143+
if ($description = $command->getDescription()) {
144+
$this->writeText('<comment>Description:</comment>', $options);
145+
$this->writeText("\n");
146+
$this->writeText(' '.$description);
147+
$this->writeText("\n\n");
148+
}
149+
143150
$this->writeText('<comment>Usage:</comment>', $options);
144151
foreach (array_merge(array($command->getSynopsis(true)), $command->getAliases(), $command->getUsages()) as $usage) {
145152
$this->writeText("\n");
@@ -154,7 +161,8 @@ protected function describeCommand(Command $command, array $options = array())
154161
$this->writeText("\n");
155162
}
156163

157-
if ($help = $command->getProcessedHelp()) {
164+
$help = $command->getProcessedHelp();
165+
if ($help && $help !== $description) {
158166
$this->writeText("\n");
159167
$this->writeText('<comment>Help:</comment>', $options);
160168
$this->writeText("\n");

‎src/Symfony/Component/Console/Tests/Fixtures/application_1.txt

Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/Tests/Fixtures/application_1.txt
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
Console Tool
22

3+
<comment>Description:</comment>
4+
description
5+
36
<comment>Usage:</comment>
47
command [options] [arguments]
58

‎src/Symfony/Component/Console/Tests/Fixtures/application_run2.txt

Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/Tests/Fixtures/application_run2.txt
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
Description:
2+
Displays help for a command
3+
14
Usage:
25
list [options] [--] [<namespace>]
36

‎src/Symfony/Component/Console/Tests/Fixtures/application_run3.txt

Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/Tests/Fixtures/application_run3.txt
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
Description:
2+
Lists commands
3+
14
Usage:
25
list [options] [--] [<namespace>]
36

‎src/Symfony/Component/Console/Tests/Fixtures/command_1.txt

Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/Tests/Fixtures/command_1.txt
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
<comment>Description:</comment>
2+
command 1 description
3+
14
<comment>Usage:</comment>
25
descriptor:command1
36
alias1

‎src/Symfony/Component/Console/Tests/Fixtures/command_2.txt

Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/Tests/Fixtures/command_2.txt
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
<comment>Description:</comment>
2+
command 2 description
3+
14
<comment>Usage:</comment>
25
descriptor:command2 [options] [--] \<argument_name>
36
descriptor:command2 -o|--option_name \<argument_name>

‎src/Symfony/Component/Console/Tests/Fixtures/command_mbstring.txt

Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/Tests/Fixtures/command_mbstring.txt
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
<comment>Description:</comment>
2+
command åèä description
3+
14
<comment>Usage:</comment>
25
descriptor:åèä [options] [--] \<argument_åèä>
36
descriptor:åèä -o|--option_name \<argument_name>

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.