Skip to content

v2.0.0

Latest

Choose a tag to compare

@HafizMMoaz HafizMMoaz released this 07 Sep 13:49
2f640d6

Breaking Changes

  • Console::run() and Console::exec() return the process exit code as an int instead of void. Callers can ignore the value, but a subclass that overrides either method with a : void signature has to be updated (#50)
  • An option declared with a type other than flag and passed without a value is now a validation error instead of being silently true (#38)
  • A command that declares -h or --help itself now receives that option instead of the console showing the auto generated help (#36)

New Features

  • Space separated option values: an option declared in $optionDefinitions with a type other than flag takes the next token, so -o value and --opt value work next to --opt=value. A negative number like -5 is an argument now and no longer needs the -- marker (#48)
  • Commands decide the process exit code with setExitCode(), returned by Console::run() (#50)
  • Uncaught command exceptions are handled by the console: setDebug() adds the class name and stack trace, setExceptionHandler() hands them to the application (#51)
  • Help output lists the argument and option definitions of a command (#49)
  • Definition defaults are applied to arguments and options before the command runs (#39)
  • New flag option type for options that are meant to be passed without a value (#38)
  • NO_COLOR and FORCE_COLOR environment conventions are honoured (#47)
  • Validation errors are translatable, with en, es and pt-br messages (#55, thanks to @mahdyaralipor)

Fixes

  • Validation messages and help output use the definition name instead of the array key (#54)
  • Help is resolved through the command registry, and value arguments are skipped when looking for it (#36)
  • Command suggestions only come from active commands and their aliases (#40)
  • CLI::strlen() strips arbitrary ANSI sequences, and style codes are cached (#45)
  • CLI::style() validates colors and formats even when the terminal has no ANSI support (#44)
  • Quiet mode silences progress(), spinner(), liveLine(), clear() and beep() (#37)
  • --quiet and --no-ansi are scoped to their dispatch instead of leaking into the next one (#41)
  • An empty argument no longer raises a string offset warning in Console::prepare() (#35)
  • composer.json requires only ext-mbstring, the unused extension requirements are gone (#42)

Internal

  • The test suite is platform independent and runs on Windows (#43)
  • CI runs the tests on PHP 8.2, 8.3 and 8.4, and the lint and static analysis jobs are blocking (#53)

Documentation

  • README examples corrected to match the actual behaviour, and the option parsing rules are documented (#46, #48)