Skip to content

Commit ca598d1

Browse files
committed
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.
1 parent cd7d745 commit ca598d1

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Console/ConsoleOptionParser.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,9 @@ public function parse($argv) {
474474
$params = $args = [];
475475
$this->_tokens = $argv;
476476
while (($token = array_shift($this->_tokens)) !== null) {
477-
if (substr($token, 0, 2) === '--') {
477+
if (isset($this->_subcommands[$token])) {
478+
continue;
479+
} elseif (substr($token, 0, 2) === '--') {
478480
$params = $this->_parseLongOption($token, $params);
479481
} elseif (substr($token, 0, 1) === '-') {
480482
$params = $this->_parseShortOption($token, $params);

0 commit comments

Comments
 (0)