#!/usr/bin/env bash DEBUG=true DEBUG=false # test if user passed a command as parameter #if test $# -lt 1 ; then #echo "Missing command, use one of the commands below" #python3 pyros.py --help #exit #fi # Guess Context : # - NO DOCKER, # or # - DOCKER OUT of container, # or # - or DOCKER IN container WITH_DOCKER_IS_SET=true [ -z $WITH_DOCKER ] && WITH_DOCKER_IS_SET=false APP_FOLDER=false [ -d ../app/ ] && APP_FOLDER=true VENV=false [ -d ./venv/ ] && VENV=true # test if docker is installed DOCKER_CMD=false [ -x "$(command -v docker)" ] && DOCKER_CMD=true # test if container is running DOCKER_CONTAINER_STARTED=false $DOCKER_CMD && [ $(docker ps | grep 'pyros' | wc -l) -eq 2 ] && DOCKER_CONTAINER_STARTED=true # # SYNTHESIS # DOCKER=false [[ $VENV == false && $DOCKER_CMD == true ]] && DOCKER=true DOCKER_OUT_CONTAINER=false [[ $DOCKER == true && $WITH_DOCKER_IS_SET == false ]] && DOCKER_OUT_CONTAINER=true #[[ $DOCKER == false && $WITH_DOCKER_IS_SET == true ]] && DOCKER_IN_CONTAINER=true if $DEBUG ; then echo $APP_FOLDER echo $VENV echo $DOCKER_CMD echo $container # Synthesis echo $DOCKER echo $DOCKER_OUT_CONTAINER exit fi # no container ? => start container first #[ $container == false ] && cd docker/ && docker-compose up -d # DOCKER_OUT_CONTAINER true ? docker exec PREFIX='' #docker exec -it pyros python3 pyros.py $* [ $DOCKER_OUT_CONTAINER == true ] && cd docker/ && docker-compose up -d && PREFIX='docker exec -it pyros' echo $PREFIX $PREFIX python3 pyros.py $*