On my machine, I have wordpressdev located at ~/sites/wordpressdev. I have a dotfiles repo with a .functions file that is sourced. In this file I just added a Bash function:
function wpdev {
cd ~/sites/wordpressdev
alias npm="lando npm"
alias grunt="lando grunt"
alias gulp="lando gulp"
alias composer="lando composer"
alias phpunit="lando phpunit"
alias wp="lando wp"
if ! grep -qi lando <<< $PS1; then
export PS1=$(sed 's/\\n/\\nLando:/' <<< $PS1)
fi
}
This sets up the Bash session for WordPress development by:
Changing the working directory to where wordpressdev is located.
Adds Bash aliases for running Lando commands.
Prefixes the bash prompt with Lando: so I know that commands will be run in the container.
It would be nice to include this as part of wordpressdev if it makes sense. Nevertheless, there is one big problem that makes this not ideal: aliases aren't inherited by subshells. What is really needed is for a pre-commit hook to be able to invoke lando phpunit by just invoking phpunit. What's even more more problematic here is that lando commands don't work in pre-commit hooks: https://github.com/lando/lando/issues/904#issuecomment-450975991
On my machine, I have
wordpressdev
located at~/sites/wordpressdev
. I have adotfiles
repo with a.functions
file that is sourced. In this file I just added a Bash function:This sets up the Bash session for WordPress development by:
wordpressdev
is located.Lando:
so I know that commands will be run in the container.It would be nice to include this as part of
wordpressdev
if it makes sense. Nevertheless, there is one big problem that makes this not ideal: aliases aren't inherited by subshells. What is really needed is for apre-commit
hook to be able to invokelando phpunit
by just invokingphpunit
. What's even more more problematic here is thatlando
commands don't work inpre-commit
hooks: https://github.com/lando/lando/issues/904#issuecomment-450975991