The inspiration for this comes from https://gist.github.com/jhoff/8fbe4116d74931751ecc9e8203dfb7c4
The following code gives you auto-complete for artisan commands in a BASH shell. Just add to your ~/.bash_profile
. If you want a faster auto-complete, run art_cache
from your project root to get a cached file of commands. To remove this file just run art_cache clear
. If you haven't created a cache file, the script uses artisan list
to get the command list dynamically (but this is a lot slower).
export ARTISAN_CMDS_FILE=bootstrap/cache/artisan-cmds.txt
function _artisan() {
COMP_WORDBREAKS=${COMP_WORDBREAKS//:}