# This file must be used with "source bin/activate" *from bash*
# you cannot run it directly

deactivate () {
    if ! [ -z "${_OLD_VIRTUAL_PS1+_}" ] ; then
        PS1="$_OLD_VIRTUAL_PS1"
        export PS1
        unset _OLD_VIRTUAL_PS1
    fi

    # This should detect bash and zsh, which have a hash command that must
    # be called to get it to forget past commands.  Without forgetting
    # past commands the $PATH changes we made may not be respected
    if [ -n "${BASH-}" ] || [ -n "${ZSH_VERSION-}" ] ; then
        hash -r 2>/dev/null
    fi
    unset SDK_VERSION SDK_VERSION_NEXT REPO_URL TWINE_USER TWINE_PASSWORD S3_BUCKET
    if [ ! "${1-}" = "nondestructive" ] ; then
    # Self destruct!
        unset -f deactivate
    fi
}

deactivate nondestructive

read -p "Enter the sdk version: " sdk_version
read -p "Enter the twine user (PyPi Developer Login): " twine_user
read -s -p "Enter the twine password (Use PyPi Developer Login for anki-developer. DO NOT USE PyPi Cozmo Login for anki-cozmo.]): " twine_password
echo
echo
echo "[Versions]"
export SDK_VERSION=$sdk_version
echo "  SDK version  : '$SDK_VERSION'"
export SDK_VERSION_NEXT="`echo $sdk_version | awk -F. '{$NF = $NF + 1;} 1' | sed 's/ /./g'`.dev0"
echo "  Next version : '$SDK_VERSION_NEXT'"
export REPO_URL="git@github.com:anki/vector-python-sdk.git"

echo
echo "[Deployments]"
export S3_BUCKET=anki-public-sdk-resources
echo "  S3_BUCKET    : '$S3_BUCKET'"
export TWINE_USER=$twine_user
export TWINE_PASSWORD=$twine_password
echo "  Twine User   : '$TWINE_USER'"

echo
echo "[Extras]"
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

if [ -z "${TOOLS_ENV_DISABLE_PROMPT-}" ] ; then
    _OLD_VIRTUAL_PS1="$PS1"
    if [ "x" != x ] ; then
        PS1="$PS1"
    else
        PS1="(sdk-tools $sdk_version) $PS1"
    fi
    export PS1
fi

# This should detect bash and zsh, which have a hash command that must
# be called to get it to forget past commands.  Without forgetting
# past commands the $PATH changes we made may not be respected
if [ -n "${BASH-}" ] || [ -n "${ZSH_VERSION-}" ] ; then
    hash -r 2>/dev/null
fi