Console Improvements in Winter 1.2

Luke Towers
Posted on Feb 28, 2022.

Console improvements

The Laravel 9 migration continues to move forward at full steam. There are a number of new features & changes coming to the Console as a part of the pending Winter CMS v1.2 update that we wanted to share with you:

Autocompletion

Symfony v5.4 added the ability for commands to be able to provide tab-autocomplete results to the shell for an improved user experience. Most Winter commands provide support for autocompletion of input values out of the box and it is easy to add support in your own custom commands when extending the Winter\Storm\Console\Command base class.

This feature requires that you run a command in your shell once in order to enable it for all Laravel / Winter console commands:

artisan completion --help

Running just artisan completion will generate the shell script required to be imported into your shell in order to enable support for autocompletion of Winter / Laravel commands; passing the --help flag will provide detailed instructions on how to install the generated script.

Read more on the Symfony blog or the Winter CMS documentation.

Signal Processing

Symfony 5.2 added support for handling signals like SIGTERM, SIGQUIT, etc (usually triggered by the user when pressing CTRL+C in the terminal) in your custom console commands.

This is extremely useful to handle clean up and logging tasks and has already been implemented in the mix:watch command (where the only way the command can end in the first place is via a process signal).

Read more on the Symfony blog.

Various small tweaks

In addition to the major new features available for console commands in Winter v1.2, a number of tweaks have been made to the existing console commands in Winter. Some of them are listed below:

  • Moved the scaffolding commands out of the Storm library and into the relevant modules for each command (i.e. create:theme goes in the CMS module, create:plugin goes in the System module)
  • Updated the scaffolding files to reflect new features (like improvements to console commands, removal of the requirement for config properties for controller behaviors, Laravel Mix & Tailwind support for themes)
  • Added autocompletion support to every core command.
  • Improved reliability of the winter:env, key:generate, and winter:install commands through the new ArrayFile and EnvFile parsers - these commands should no longer interfere with each other.
  • Added aliases for Laravel commands that are replaced by winter commands (i.e. make:model -> create:model, migrate -> winter:up, etc) to make the developer experience of using Winter more familiar to developers with Laravel experience.
  • Revised the list of Laravel-provided commands that are registered by default in Winter to remove commands that don't make sense in Winter projects or otherwise don't work with Winter and add commands that have been added to Laravel in the past couple of years.

Conclusion

These are just a few of the many exciting improvements coming in Winter v1.2! Interested in trying them out now? The Laravel 9 PR is ready and available for testing in your projects today! Follow the instructions at https://github.com/wintercms/winter/pull/148 in order to start testing Winter v1.2 with your projects now!

More

Keep informed

Sign up to our newsletter and receive updates on Winter releases, new features in the works, plugin and theme promotions and much more!