Skip to content

Instantly share code, notes, and snippets.

@VictorGob
Created August 26, 2024 09:53
Show Gist options
  • Save VictorGob/0e59d72f8fc96e589fae945526e37cab to your computer and use it in GitHub Desktop.
Save VictorGob/0e59d72f8fc96e589fae945526e37cab to your computer and use it in GitHub Desktop.
Alias to check that the local environment is activated, if not, activate it.
alias checkvenv='if [ "$VIRTUAL_ENV" = "$(pwd)/.venv" ]; then echo -e "\033[0;32m*** VIRTUAL_ENV OK ***\033[0m"; else echo "VIRTUAL_ENV does not match current directory, activating local venv"; if [ -f ".venv/bin/activate" ]; then source .venv/bin/activate; else echo "No .venv found in current directory"; fi; fi'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment