Skip to content

Commit

Permalink
Merge pull request #20 from adhocore/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
adhocore authored Jul 13, 2018
2 parents 734d84e + e0672a5 commit b05fcc2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -282,4 +282,5 @@ $reader->read('abc', 'trim');

### Related

- [adhocore/phalcon-ext](https://github.com/adhocore/phalcon-ext)
- [adhocore/phalcon-ext](https://github.com/adhocore/phalcon-ext) Phalcon extension using `adhocore/cli`
- [adhocore/phint](https://github.com/adhocore/phint) PHP project scaffolding app using `adhocore/cli`
4 changes: 4 additions & 0 deletions src/Input/Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,10 @@ public function showHelp()
->showArgumentsHelp($this->allArguments())
->showOptionsHelp($this->allOptions(), '', 'Legend: <required> [optional]');

if ($this->_usage) {
$writer->eol()->greenBold('Usage Examples:', true)->raw(\trim($this->_usage))->eol();
}

return $this->emit('_exit', 0);
}

Expand Down
6 changes: 5 additions & 1 deletion tests/Input/DefaultOptionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,16 @@ public function test_V()
public function test_help()
{
$p = $this->newCommand()
->arguments('[arg]')
->argument('[arg]', 'Some desc')
->option('-o --option')
->usage('cmdname --option opt <arg>')
->parse(['php', '--help']);

$this->assertContains('cmdname', $buffer = $this->buffer());
$this->assertContains('Usage Examples:', $buffer);
$this->assertContains('--option opt <arg>', $buffer);
$this->assertContains('[arg]', $buffer);
$this->assertContains('Some desc', $buffer);
$this->assertContains('[-o|--option]', $buffer);
}

Expand Down

0 comments on commit b05fcc2

Please sign in to comment.