zsh: Add venv function

This enables or lists virtual environments
This commit is contained in:
Tom Willemsen 2013-02-06 11:44:04 +01:00
parent dca5bacd6c
commit 0445ad9f57
2 changed files with 16 additions and 1 deletions

View file

@ -2,6 +2,6 @@ DESTDIR:=$(DESTDIR)/functions
objects=chpwd_show_todo chpwd_update_git_vars env get_cnt line \
precmd_maybe_festival precmd_update_git_vars precmd_update_updates \
preexec_update_vars prompt prompt_git_info rprompt \
update_current_git_vars welcome
update_current_git_vars welcome venv
include ../../dotfiles.mk

15
.zsh/functions/venv Normal file
View file

@ -0,0 +1,15 @@
# -*- mode: sh; -*-
if [ "${#}" -eq 1 ]; then
venv_activate="$HOME/.virtualenv/$1/bin/activate"
if [ -r "$venv_activate" ]; then
source $venv_activate
else
echo "$1 is not a know virtual environment"
fi
else
echo "Virtual environments: "
for itm in ~/.virtualenv/*; do
echo " $(basename $itm)"
done
fi