Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Rob Allen:
Autocomplete Composer script names on the command line
May 15, 2017 @ 09:43:22

Rob Allen has a quick new post with a handy script you can use to auto-complete Composer script names on the command line (for bash).

As I add more and more of my own script targets to my composer.json files, I find that it would be helpful to have tab autocomplete in bash. I asked on Twitter and didn't get an immediate solution and as I had already done something similar for Phing, I rolled up my sleeves and wrote my own.

He created the bash completion file where Bash could locate it (a special "bash_completion.d" directory). He includes the code you'll need to have in the bash script and briefly explains how each line works. He also includes an example of the output showing how the script catches both the built-in and custom commands as auto-complete options.

tagged: autocomplete composer script bash commandline tutorial

Link: https://akrabat.com/autocomplete-composer-script-names-on-the-command-line/