Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Skip token when it is a subcommand
Not skipping the token will then cause it to be passed through parseArg()
which will see it as too many arguments being passed.
  • Loading branch information
rchavik committed Jun 6, 2014
1 parent cd7d745 commit ca598d1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Console/ConsoleOptionParser.php
Expand Up @@ -474,7 +474,9 @@ public function parse($argv) {
$params = $args = [];
$this->_tokens = $argv;
while (($token = array_shift($this->_tokens)) !== null) {
if (substr($token, 0, 2) === '--') {
if (isset($this->_subcommands[$token])) {
continue;
} elseif (substr($token, 0, 2) === '--') {
$params = $this->_parseLongOption($token, $params);
} elseif (substr($token, 0, 1) === '-') {
$params = $this->_parseShortOption($token, $params);
Expand Down

0 comments on commit ca598d1

Please sign in to comment.