New in Symfony CLI: Command auto-completion
October 15, 2024 • Published by Tugdual Saunier
As developers, we spend a lot of time in the terminal running dozens of commands. Some commands can be long to type or tricky and be similar to other tools but not exactly the same! That is why a lot of us loves autocompletion.
The good news is that starting with Symfony CLI v5.10, the Symfony CLI provides an auto-completion for Bash, ZSH, and Fish shells.
To enable it, follow the instructions shown by symfony completion --help
.
But this is not it! Did you know that Symfony Console provides auto-completion
for bin/console
within your shell? It does! Since version 5.4 for Bash, 6.1
for Fish, and 6.2 for ZSH. This why the Symfony CLI can forward auto-complete
instructions to your Symfony project when auto-completing symfony console
[TAB]
out of the box!
But there is more! You might know that Composer itself uses Symfony Console. So
yes, symfony composer
also works!
This is a great for anyone working on several projects with different environments, Symfony or PHP versions to get an auto-completion that works seamlessly.
As a nice little bonus, because Symfony CLI is also developed using standalone Open-Source libraries, this auto-completion feature is now available for any tool using symfony-cli/console, as the Blackfire CLI.
Help the Symfony project!
As with any Open-Source project, contributing code or documentation is the most common way to help, but we also have a wide range of sponsoring opportunities.
Finally. Thanks a bunch!!