Releases: yannoff/console
2.3.0
Release notes
Features
Improvement in exceptions handling
- All exception are now handled and rendered properly in
Application::run()
method - Calling a command without all mandatory arguments now raise an error message
Breaking changes
The new StreamAware
interface may conflict with version 2.0 StreamAware
abstract class.
Changelog
2.2.2
2.2.1
Version 2.2.1 has been released 🚀
Fix: Added support for nested styles in formatter input
The PosixFormatter::format()
now correctly interprets contents with nested tags, provided the Dick congruence is respected.
Example:
This is a <bold>well-formed expression with a <yellow>nested</yellow> style</bold>
Changelog
2.2.0
Version 2.2.0 has been released 🚀
New feature: Closure support
As an alternative to extending the base command and implementing the execute()
method, the code to be executed at runtime may now be passed as a Closure
to the Command
constructor.
As a consequence, the Command
class is not anymore abstract and can be instanciated directly.
$command = new Command('hello', function() {
$this->stdout->write('Hello World !');
return 0;
}
Deprecations
The Formatter
character sequences constants will be soon removed, in favor of the ASCII
class constants
- Use
ASCII::CR
instead ofFormatter::CR
- Use
ASCII::LF
instead ofFormatter::LF
- Use
ASCII::CRLF
instead ofFormatter::CRLF
- Use
ASCII::TAB
instead ofFormatter::TAB
- Use
ASCII::STAB
instead ofFormatter::STAB
- Use
Application::PAD
instead ofFormatter::PAD
Changelog
2.1.0
Version 2.1.0 released
Upgrading from 2.0.0
The whole stream handling methods have been rehomed in IOHelper
- The
StreamAware
super class have been removed - The stream pseudo-properties are now handled by the trait's
__get()
method
To implement a proper __get()
method in a class which uses the trait, one will have to import IOHelper::__get()
as an alias.
class Acme
{
use IOHelper {
__get as __stream_get;
}
// Implement proper magic getter
public function __get($name)
{
// Put user-defined logic here
if ($name == 'foo') {
return 'bar';
}
// ...
// Call the trait method then
return $this->__stream_get($name);
}
}
2.0.0 (GA)
Version 2.0.0
released ! 🚀
Upgrading from version 1.x
StreamAwareTrait
have been removed, in favor of IOHelper
StreamAwareTrait::ioread()
is replaced byIOHelper::read()
StreamAwareTrait::iowrite()
is replaced byIOHelper::write()
StreamAwareTrait::ioerror()
is replaced byIOHelper::error()
Command::errorln()
and Command::writeln()
have been removed
- Use
error()
instead oferrorln()
- Use
write()
instead ofwriteln()
FormatterFactory
have been removed
- Use
Registry::get()
ifIOHelper
stream properties are available - Use
new PosixFormatter()
otherwise (eg. when in a static context)
Formatter
classes are not anymore injected in Application
& Command
- Now formatters are stored in an application-wide
FormatterRegistry
- The formatter is picked by output methods at each call, allowing for a better context detection (pipe, reg file, tty...)
Verbosity level is now stored in the main $level
publicly accessible static property
- Use
Verbosity::get()
instead ofCommand::getVerbosity()
- Use
Verbosity::set()
instead ofCommand::setVerbosity()