[console] Use the description when no help is available
This commit is contained in:
parent
9962f36f97
commit
e5d3f2567d
|
@ -484,7 +484,7 @@ class Command
|
||||||
*/
|
*/
|
||||||
public function getHelp()
|
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');
|
$ret = $command->setHelp('help1');
|
||||||
$this->assertEquals($command, $ret, '->setHelp() implements a fluent interface');
|
$this->assertEquals($command, $ret, '->setHelp() implements a fluent interface');
|
||||||
$this->assertEquals('help1', $command->getHelp(), '->setHelp() sets the help');
|
$this->assertEquals('help1', $command->getHelp(), '->setHelp() sets the help');
|
||||||
|
$command->setHelp('');
|
||||||
|
$this->assertEquals('description', $command->getHelp(), '->getHelp() fallback to the description');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetProcessedHelp()
|
public function testGetProcessedHelp()
|
||||||
|
|
|
@ -97,7 +97,7 @@
|
||||||
<command id="foo:bar" name="foo:bar">
|
<command id="foo:bar" name="foo:bar">
|
||||||
<usage>foo:bar</usage>
|
<usage>foo:bar</usage>
|
||||||
<description>The foo:bar command</description>
|
<description>The foo:bar command</description>
|
||||||
<help/>
|
<help>The foo:bar command</help>
|
||||||
<aliases>
|
<aliases>
|
||||||
<alias>afoobar</alias>
|
<alias>afoobar</alias>
|
||||||
</aliases>
|
</aliases>
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<command id="foo:bar" name="foo:bar">
|
<command id="foo:bar" name="foo:bar">
|
||||||
<usage>foo:bar</usage>
|
<usage>foo:bar</usage>
|
||||||
<description>The foo:bar command</description>
|
<description>The foo:bar command</description>
|
||||||
<help/>
|
<help>The foo:bar command</help>
|
||||||
<aliases>
|
<aliases>
|
||||||
<alias>afoobar</alias>
|
<alias>afoobar</alias>
|
||||||
</aliases>
|
</aliases>
|
||||||
|
|
Reference in New Issue