Created
June 13, 2016 10:12
-
-
Save sideshowcoder/2a30b1ef02dfd2813014f42269165bf9 to your computer and use it in GitHub Desktop.
Setup docker-machine env for Emacs to use
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
(defun setup-docker-machine-env () | |
" Parse the output of docker-machine env and setup the needed env vars" | |
(interactive) | |
(mapcar | |
(lambda (e) | |
(if e | |
(let ((var-value (split-string-and-unquote (car e) "="))) | |
(setenv (s-chop-suffix "=" (car var-value)) (car (cdr var-value)))))) | |
(mapcar | |
(lambda (e) | |
(cdr (s-split " " e 't))) | |
(remove-if | |
(lambda (e) | |
(s-starts-with? "#"e)) | |
(s-lines (shell-command-to-string "docker-machine env")))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
thanks !
but in windows
split-string-and-unquote
not work very well.eval setup-docker-machine-env throw a error
so i decide to using split-string replace split-string-and-unquote and import s.el help me replace quote