Only --opt=value carries a value today. -o value and --opt value put the value into the argument list instead (src/Console.php:427-445):
php app serve -h 0.0.0.0 --port 8080
# options: h => true, port => true
# arguments: ['0.0.0.0', '8080']
That is the form most CLIs use, the README already tells users it works, and without it a command cannot accept a value under a short name at all.
Since -abc currently expands to three boolean flags, this needs the option definitions to disambiguate: an option declared in $optionDefinitions with a type other than a flag consumes the next token when it is not itself an option. Options with no definition keep the current behaviour, which keeps this backward compatible.
Related edge case worth handling at the same time: a negative number argument is parsed as options today, so php app calc -5 yields ['5' => true] and no arguments. Requiring -- to pass it is a workaround, but a token that is numeric after the dash could reasonably be treated as an argument.
Only
--opt=valuecarries a value today.-o valueand--opt valueput the value into the argument list instead (src/Console.php:427-445):That is the form most CLIs use, the README already tells users it works, and without it a command cannot accept a value under a short name at all.
Since
-abccurrently expands to three boolean flags, this needs the option definitions to disambiguate: an option declared in$optionDefinitionswith a type other than a flag consumes the next token when it is not itself an option. Options with no definition keep the current behaviour, which keeps this backward compatible.Related edge case worth handling at the same time: a negative number argument is parsed as options today, so
php app calc -5yields['5' => true]and no arguments. Requiring--to pass it is a workaround, but a token that is numeric after the dash could reasonably be treated as an argument.