Last active
November 12, 2016 14:30
-
-
Save petehalverson/83c4ae282244fd6aef442c31e348d29d to your computer and use it in GitHub Desktop.
Revisions
-
petehalverson revised this gist
Nov 12, 2016 . 1 changed file with 9 additions and 8 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,15 +1,16 @@ # add to .bashrc, .bash_profile, ~/.profile dockenv() { command -v "docker-machine" >/dev/null 2>&1 && { if [ $1 = 'unset' -o $1 = '-u' ]; then eval $(docker-machine env -u) else eval $(docker-machine env "$1") if ! [ $1 = 'unset' -o $1 = '-u' ]; then docker-machine ip $1 | tr -d '\n' | pbcopy fi fi } || { echo >&2 "Error: \`docker-machine\` is required but not installed. Aborting..."; } } _dockenv() { local cur="${COMP_WORDS[COMP_CWORD]}" COMPREPLY=( $(compgen -W "$(docker-machine ls -q)" -- $cur) ) -
petehalverson revised this gist
Nov 12, 2016 . 1 changed file with 3 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -4,6 +4,9 @@ dockenv() { eval $(docker-machine env -u) else eval $(docker-machine env "$1") if ! [ $1 = 'unset' -o $1 = '-u' ]; then docker-machine ip $1 | tr -d '\n' | pbcopy fi fi } -
petehalverson created this gist
Nov 12, 2016 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,14 @@ # add to .bashrc, .bash_profile, ~/.profile dockenv() { if [ $1 = 'unset' -o $1 = '-u' ]; then eval $(docker-machine env -u) else eval $(docker-machine env "$1") fi } _dockenv() { local cur="${COMP_WORDS[COMP_CWORD]}" COMPREPLY=( $(compgen -W "$(docker-machine ls -q)" -- $cur) ) } complete -o default -F _dockenv dockenv