bug #15601 [console] Use the description when no help is available (Nicofuma)
This PR was merged into the 2.3 branch.
Discussion
----------
[console] Use the description when no help is available
| Q | A
| ------------- | ---
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #15498
| License | MIT
| Doc PR |
Commits
-------
e5d3f25
[console] Use the description when no help is available
This commit is contained in:
commit
cb303017b4
|
@ -484,7 +484,7 @@ class Command
|
|||
*/
|
||||
public function getHelp()
|
||||
{
|
||||
return $this->help;
|
||||
return $this->help ?: $this->description;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -131,6 +131,8 @@ class CommandTest extends \PHPUnit_Framework_TestCase
|
|||
$ret = $command->setHelp('help1');
|
||||
$this->assertEquals($command, $ret, '->setHelp() implements a fluent interface');
|
||||
$this->assertEquals('help1', $command->getHelp(), '->setHelp() sets the help');
|
||||
$command->setHelp('');
|
||||
$this->assertEquals('description', $command->getHelp(), '->getHelp() fallback to the description');
|
||||
}
|
||||
|
||||
public function testGetProcessedHelp()
|
||||
|
|
|
@ -97,7 +97,7 @@
|
|||
<command id="foo:bar" name="foo:bar">
|
||||
<usage>foo:bar</usage>
|
||||
<description>The foo:bar command</description>
|
||||
<help/>
|
||||
<help>The foo:bar command</help>
|
||||
<aliases>
|
||||
<alias>afoobar</alias>
|
||||
</aliases>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<command id="foo:bar" name="foo:bar">
|
||||
<usage>foo:bar</usage>
|
||||
<description>The foo:bar command</description>
|
||||
<help/>
|
||||
<help>The foo:bar command</help>
|
||||
<aliases>
|
||||
<alias>afoobar</alias>
|
||||
</aliases>
|
||||
|
|
Reference in New Issue