#!/bin/bash



Wai=$(realpath $(dirname $0))

source ${Wai}/Template/function

TestEnv realpath
TestEnv docker
TestEnv tput

cd ${Wai}

Exec=$1

[[ -z "${Exec}" ]] && help 
#[[ "${Exec}" == "image" ]] && GenAll
#[[ "${Exec}" == "image-gen" ]] && DockerGen gen
#[[ "${Exec}" == "image-repo" ]] && DockerGen repo
#[[ "${Exec}" == "link" ]] && LinkESL
#[[ "${Exec}" == "repo" ]] && DockerComposeRun repo
#[[ "${Exec}" == "stop" ]] && DockerStop
#[[ "${Exec}" == "gen" ]] && DockerComposeRun gen 
#[[ "${Exec}" == "run-gen" ]] && DockerConnect gen $2
#[[ "${Exec}" == "run-repo" ]] && DockerConnect repo $2
#[[ "${Exec}" == "import-image" ]] && DockerImport
#[[ "${Exec}" == "save-image" ]] && DockerSave
#
case $Exec in 
	image-gen)   DockerGen gen;;
	image-repo)   DockerGen repo;;
	repo)   DockerComposeRun repo;;
	stop)   DockerStop;;
	gen)   DockerComposeRun gen ;;
	link) LinkESL;;
	run-gen)   DockerConnect gen $2;;
	run-repo)   DockerConnect repo $2;;
	import-image)	DockerImport;;
	save-image)	DockerSave;;
	*) help
esac






if [[ "${Exec}" == "all" ]]
	then
		GenAll
		DockerComposeRun repo 
		DockerComposeRun gen Print
fi


