Skip to content

Commit

Permalink
(env) no need to switch when same env or no prev env
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthijsBurgh committed Oct 24, 2024
1 parent 34a003b commit 3f36103
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion setup/tue-env.bash
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,16 @@ Environment directory '${tue_env_dir}' didn't exist (anymore)"""

[[ "${persistent}" == "true" ]] && tue-env set-default "${tue_env}"

_tue-env-deactivate-current-env || { echo "[tue-env](switch) Failed to deactivate the current environment, don't use this terminal anymore, open a new terminal"; return 1; }
if [[ -n "${TUE_ENV}" ]]
then
if [[ "${TUE_ENV}" == "${tue_env}" ]]
then
echo "[tue-env](switch) Already in the '${tue_env}' environment"
return 0
fi
echo "[tue-env](switch) Deactivating the current environment '${TUE_ENV}'"
_tue-env-deactivate-current-env || { echo "[tue-env](switch) Failed to deactivate the current environment, don't use this terminal anymore, open a new terminal"; return 1; }
fi

# Successful, so we can set the environment variables
TUE_ENV=${tue_env}
Expand Down

0 comments on commit 3f36103

Please sign in to comment.