Several README examples do not match what the code does. All checked against main (2c0159f) on PHP 8.4.19.
getInput() is not a prompt. Its argument is $prepend, used internally for backslash line continuation, and it is prefixed to the return value instead of being printed:
$name = CLI::getInput('Name: ');
// nothing is printed, and $name === 'Name: Alice'
prompt() does not repeat until a valid option is given (README line 69). There is no validation loop: it returns whatever was typed, and only falls back to the first option when the input is empty.
CLI::prompt('Continue?', ['y', 'n']); // typing "maybe" returns 'maybe'
-o value options are not supported (README line 140). Only --opt=value carries a value. -o value sets o to true and pushes value into the arguments:
php app serve -h 0.0.0.0 # getOption('h') === true, getArgument(0) === '0.0.0.0'
Unknown commands do not fall back to Index (README line 31). commandNotFound() prints an error and exits 1.
run() does not dispatch to exec() (README line 30). exec() is the other way round: it re-parses a command string and then calls run().
info() is cyan, not blue (README line 61).
The prompt() and -o value items could be fixed in the code instead of the docs, since both are reasonable features to have. I opened separate issues for those two.
Several README examples do not match what the code does. All checked against main (2c0159f) on PHP 8.4.19.
getInput()is not a prompt. Its argument is$prepend, used internally for backslash line continuation, and it is prefixed to the return value instead of being printed:prompt()does not repeat until a valid option is given (README line 69). There is no validation loop: it returns whatever was typed, and only falls back to the first option when the input is empty.-o valueoptions are not supported (README line 140). Only--opt=valuecarries a value.-o valuesetsototrueand pushesvalueinto the arguments:php app serve -h 0.0.0.0 # getOption('h') === true, getArgument(0) === '0.0.0.0'Unknown commands do not fall back to
Index(README line 31).commandNotFound()prints an error and exits 1.run()does not dispatch toexec()(README line 30).exec()is the other way round: it re-parses a command string and then callsrun().info()is cyan, not blue (README line 61).The
prompt()and-o valueitems could be fixed in the code instead of the docs, since both are reasonable features to have. I opened separate issues for those two.