Skip to content

Instantly share code, notes, and snippets.

@westonruter
Last active August 24, 2019 23:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save westonruter/e200e38386b5912e55b3c5902659b431 to your computer and use it in GitHub Desktop.
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.
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