def docker_machine(machine):
"""
Sets the environment to use a given docker machine.
"""
_env = local('docker-machine env {}'.format(machine), capture=True)
# Reorganize into a string that could be used with prefix().
_env = re.sub(r'^#.*$', '', _env, flags=re.MULTILINE) # Remove comments
_env = re.sub(r'^export ', '', _env, flags=re.MULTILINE) # Remove `export `
_env = re.sub(r'\n', ' ', _env, flags=re.MULTILINE) # Merge to a single line
return _env
评论列表
文章目录