[Terminal] Docker-machine env shortcut
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
# 1. Add this to your .bash-profile or .zshrc and restart your terminal | |
function dm-env () { | |
if [ -z "$1" ] ; then | |
echo "\e[0;31mERROR:\e[0m no argument supplied" | |
return; | |
fi | |
eval "$(docker-machine env $1)" | |
echo -e "\033[33;32mSUCCESS:\e[0m docker-machine environment set to: $1" | |
} | |
# Usage: | |
$ dm-env your-docker-machine-name | |
# Example: | |
$ dm-env dev | |
=> SUCCESS: docker-machine environment set to: dev | |
# Example without argument: | |
$ dm-env | |
=> ERROR: no argument supplied |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment