8000 [console] Use the description when no help is available · symfony/symfony@641f859 · GitHub
[go: up one dir, main page]

Skip to content

Commit 641f859

Browse files
author
Tristan Darricau
committed
[console] Use the description when no help is available
1 parent 9962f36 commit 641f859

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,7 @@ public function setHelp($help)
484484
*/
485485
public function getHelp()
486486
{
487-
return $this->help;
487+
return $this->help ?: $this->description;
488488
}
489489

490490
/**

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,8 @@ public function testGetSetHelp()
131131
$ret = $command->setHelp('help1');
132132
$this->assertEquals($command, $ret, '->setHelp() implements a fluent interface');
133133
$this->assertEquals('help1', $command->getHelp(), '->setHelp() sets the help');
134+
$command->setHelp(null);
135+
$this->assertEquals('description', $command->getHelp(), '->getHelp() fallback to the description');
134136
}
135137

136138
public function testGetProcessedHelp()

0 commit comments

Comments
 (0)
0