Skip to content

Commit b05fcc2

Browse files
authored
Merge pull request #20 from adhocore/develop
Develop
2 parents 734d84e + e0672a5 commit b05fcc2

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,4 +282,5 @@ $reader->read('abc', 'trim');
282282

283283
### Related
284284

285-
- [adhocore/phalcon-ext](https://github.com/adhocore/phalcon-ext)
285+
- [adhocore/phalcon-ext](https://github.com/adhocore/phalcon-ext) Phalcon extension using `adhocore/cli`
286+
- [adhocore/phint](https://github.com/adhocore/phint) PHP project scaffolding app using `adhocore/cli`

src/Input/Command.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,10 @@ public function showHelp()
315315
->showArgumentsHelp($this->allArguments())
316316
->showOptionsHelp($this->allOptions(), '', 'Legend: <required> [optional]');
317317

318+
if ($this->_usage) {
319+
$writer->eol()->greenBold('Usage Examples:', true)->raw(\trim($this->_usage))->eol();
320+
}
321+
318322
return $this->emit('_exit', 0);
319323
}
320324

tests/Input/DefaultOptionTest.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,16 @@ public function test_V()
2222
public function test_help()
2323
{
2424
$p = $this->newCommand()
25-
->arguments('[arg]')
25+
->argument('[arg]', 'Some desc')
2626
->option('-o --option')
27+
->usage('cmdname --option opt <arg>')
2728
->parse(['php', '--help']);
2829

2930
$this->assertContains('cmdname', $buffer = $this->buffer());
31+
$this->assertContains('Usage Examples:', $buffer);
32+
$this->assertContains('--option opt <arg>', $buffer);
3033
$this->assertContains('[arg]', $buffer);
34+
$this->assertContains('Some desc', $buffer);
3135
$this->assertContains('[-o|--option]', $buffer);
3236
}
3337

0 commit comments

Comments
 (0)