refactor: add skip pyenv install

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

20
bin/app
View File

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