refactor: add skip pyenv install
This commit is contained in:
parent
a8b4576acb
commit
ad4a22475a
24
bin/app
24
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
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user