Last active
August 24, 2019 23:52
-
-
Save westonruter/e200e38386b5912e55b3c5902659b431 to your computer and use it in GitHub Desktop.
Put this function in your .bashrc (or the like) to automatically route commands into Lando. Note the PS1 logic may need to be tweaked.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function landoify { | |
shopt -s expand_aliases | |
# Define aliases for commands to route into the container. | |
alias npm="lando npm" | |
alias yarn="lando yarn" | |
alias npx="lando npx" | |
alias grunt="lando grunt" | |
alias gulp="lando gulp" | |
alias composer="lando composer" | |
alias phpunit="lando phpunit" | |
alias wp="lando wp" | |
# Add any other aliases you want based on your environment. | |
# Prefix your prompt with "Lando" so you know that your commands will be routed into the container. | |
if ! grep -qi lando <<< $PS1; then | |
export PS1=$(sed 's/\\n/\\nLando:/' <<< $PS1) | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment