Skip to content

Instantly share code, notes, and snippets.

View paveldedik's full-sized avatar
🦠

Pavel Dedik paveldedik

🦠
View GitHub Profile
@paveldedik
paveldedik / use_env.sh
Created January 22, 2014 10:54
Command which activates or creates a virtual environment. It's a modification of the original command which doesn't work for me properly.
# The use_env call below is a reusable command to activate/create a new Python
# virtualenv, requiring only a single declarative line of code in your .env files.
# It only performs an action if the requested virtualenv is not the current one.
use_env() {
typeset venv
venv="$1"
if [[ "${VIRTUAL_ENV##*/}" != "$venv" ]]; then
if workon | grep -q "$venv"; then
workon "$venv"
else