default_value=vue-fastapi-admin
app=${1:-$default_value}
platform=$(uname -s)

if [ "${platform}" == "Linux" ]; then
    env_path=/data/env/python/${app}
    bin_path=${env_path}/bin
# 使用 [[ ]] 进行模式匹配
elif [[ "${platform}" == *"MINGW64"* ]]; then
    env_path=/d/data/python-venv/${app}
    bin_path=${env_path}/Scripts
fi

if [ -d "${env_path}" ]; then
    echo "Activating virtual environment..."
    source ${bin_path}/activate
else
    echo "Creating virtual environment..."
    python -m venv ${env_path}
    echo "Activating virtual environment..."
    source ${bin_path}/activate
    pip install -r requirements.txt
fi
