From ad4a22475a109231edf855a48dcb3040dbdcac5d Mon Sep 17 00:00:00 2001 From: Mark Bailey Date: Mon, 4 Nov 2024 14:12:41 -0500 Subject: [PATCH] refactor: add skip pyenv install --- bin/app | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/bin/app b/bin/app index 90074cb..7237fa6 100755 --- a/bin/app +++ b/bin/app @@ -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 }