feat bash functions ve,va
This commit is contained in:
parent
2404c83783
commit
6ded275dd3
@ -40,7 +40,16 @@ ve() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
va() {
|
va() {
|
||||||
if [ -f "./venv/bin/activate" ]; then
|
if [[ -v 1 ]]; then
|
||||||
|
if [[ -f "${1}/bin/activate" ]]; then
|
||||||
|
source "${1}/bin/activate"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
echo "va: error: virtual environment ${1} not found, use python3 -m virtualenv venv" >&2
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -f "./venv/bin/activate" ]]; then
|
||||||
source "./venv/bin/activate"
|
source "./venv/bin/activate"
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
@ -49,7 +58,7 @@ va() {
|
|||||||
activate_venv="$(find -P . -maxdepth 3 -type f -wholename '*/bin/activate' | sort | head -n 1)"
|
activate_venv="$(find -P . -maxdepth 3 -type f -wholename '*/bin/activate' | sort | head -n 1)"
|
||||||
readonly activate_venv
|
readonly activate_venv
|
||||||
|
|
||||||
if [ -n "$activate_venv" ]; then
|
if [[ -f "$activate_venv" ]]; then
|
||||||
source "$activate_venv"
|
source "$activate_venv"
|
||||||
return 0
|
return 0
|
||||||
else
|
else
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user