Skip to content

Commit ac70008

Browse files
committed
parser: fix long option with equal
1 parent 159c231 commit ac70008

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

autoload.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,12 @@ public static function setSingleThread(bool $bool = false){
3636
}
3737
}
3838

39-
public static function initTerminal(bool $formattingCodes = true){
39+
/**
40+
* Initiate Terminal
41+
*
42+
* @param bool|null $formattingCodes
43+
*/
44+
public static function initTerminal(?bool $formattingCodes = null){
4045
\iTXTech\SimpleFramework\Console\Terminal::$formattingCodes = $formattingCodes;
4146
\iTXTech\SimpleFramework\Console\Terminal::init();
4247
}

src/iTXTech/SimpleFramework/Console/Option/Parser.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ private function handleLongOptionWithoutEqual(string $token){
257257
* @throws ParseException
258258
*/
259259
private function handleLongOptionWithEqual(string $token){
260-
list($value, $opt) = explode("=", $token, 2);
260+
list($opt, $value) = explode("=", $token, 2);
261261
$matchingOpts = $this->getMatchingLongOptions($opt);
262262
if(empty($matchingOpts)){
263263
$this->handleUnknownToken($this->currentToken);
@@ -356,6 +356,11 @@ private function isJavaProperty(string $token){
356356
return $option !== null && ($option->getArgs() >= 2 or $option->getArgs() === Option::UNLIMITED_VALUES);
357357
}
358358

359+
/**
360+
* @param Option $option
361+
*
362+
* @throws ParseException
363+
*/
359364
private function handleOption(Option $option){
360365
$this->checkRequiredArgs();
361366

@@ -404,6 +409,11 @@ private function getMatchingLongOptions(string $token) : array{
404409
}
405410
}
406411

412+
/**
413+
* @param string $token
414+
*
415+
* @throws ParseException
416+
*/
407417
protected function handleConcatenatedOptions(string $token){
408418
for($i = 1; $i < strlen($token) - 1; $i++){
409419
$c = $token{$i};

0 commit comments

Comments
 (0)