Added venv command

This commit is contained in:
utahta
2011-07-21 02:14:41 +09:00
parent ef4ff75630
commit b4a6674fba
11 changed files with 133 additions and 68 deletions
+37
View File
@@ -61,6 +61,42 @@ __pythonbrew_update()
[[ $? == 0 ]] && __pythonbrew_reload
}
__pythonbrew_venv()
{
command pythonbrew "$@"
if [[ $? == 0 ]] ; then
source "$PATH_ETC/venv"
args=()
for arg in "$@" ; do
if [[ $param_skip = 1 ]] ; then
param_skip=0
continue
fi
case $arg in
-p) param_skip=1 ; continue ;;
--python) param_skip=1 ; continue ;;
esac
args=("${args[@]}" $arg)
done
for arg in ${args[@]} ; do
case $arg in
create)
for proj in ${args[@]:2} ; do
mkvirtualenv $proj
done
;;
delete)
for proj in ${args[@]:2} ; do
rmvirtualenv $proj
done
;;
use) workon ${args[2]} ;;
list) workon ;;
esac
done
fi
}
__pythonbrew_find_command()
{
command_name=""
@@ -84,6 +120,7 @@ pythonbrew()
switch) __pythonbrew_switch "$@" ;;
off) __pythonbrew_off "$@" ;;
update) __pythonbrew_update "$@" ;;
venv) __pythonbrew_venv "$@" ;;
*) command pythonbrew "$@" ;;
esac
builtin hash -r