refactor: add skip pyenv install

This commit is contained in:
Mark Bailey 2024-11-04 14:12:41 -05:00
parent a8b4576acb
commit ad4a22475a

24
bin/app
View File

@ -8,8 +8,24 @@ _activate_venv() {
_venv() {
_py_version=${1:-3.12.0}
pyenv install $_py_version
pyenv shell $_py_version
case "$1" in
--skip)
_skip=true
shift
;;
*) _skip=false ;;
esac
if ! $_skip; then
pyenv install $_py_version
#init pyenv
export PYENV_ROOT="$HOME/.pyenv"
[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
pyenv shell $_py_version
fi
if [ -d .venv ]; then
rm -rf .venv
@ -86,12 +102,11 @@ _main() {
fi
_cmd="${1:-help}"
if ! [ -z "$_cmd" ]; then
if ! [ -z "$@" ]; then
shift
fi
case "$_cmd" in
--*) ;;
help | -h) _help ;;
"$START_match") _start "$@" ;;
"$VENV_match") _venv "$@" ;;
@ -100,6 +115,7 @@ _main() {
_init
;;
"$FREEZE_match") _freeze ;;
--*) ;;
esac
}