cumulative update

This commit is contained in:
Arthur Khachaturov 2024-06-19 11:51:19 +03:00
parent 3ecbac352e
commit c360fc2339
71 changed files with 3281 additions and 380 deletions

72
.local/scripts/_venv Normal file
View file

@ -0,0 +1,72 @@
VENV_FOLDER=".venv"
OPERATION=c
deactivate_() {
if [ ! -z "${VIRTUAL_ENV}" ]; then
deactivate
fi
}
create_or_activate() {
if [ -z "${VIRTUAL_ENV}" ]; then
if [ -d "${VENV_FOLDER}" ]; then
source ./${VENV_FOLDER}/bin/activate
else
python3 -m venv "${VENV_FOLDER}"
source ./${VENV_FOLDER}/bin/activate
fi
else
deactivate
fi
}
remove() {
deactivate_
if [ -d "${VENV_FOLDER}" ]; then
rm -r "${VENV_FOLDER}"
fi
}
while [ "$#" -gt 0 ]; do
case "$1" in
'-c'|"--create")
OPERATION=c
;;
'-r'|"--remove")
OPERATION=r
;;
'-d'|"--deactivate")
deactivate_
return
;;
'-h'|"--help")
echo "venv [OPTION] [VENV_FOLDER]"
echo
echo "ARGUMENTS:"
echo "\t VENV_FOLDER \t\t Folder containing virtual environment"
echo
echo "OPTIONS:"
echo "\t -c, --create \t\t Create virtual environment"
echo "\t -d, --deactivate \t Exit virtual environment"
echo "\t -r, --remove \t\t Deactivate and remove virtual environment"
echo "\t -h, --help \t\t Print this message"
return
;;
*)
VENV_FOLDER="$1"
;;
esac
shift
done
case "${OPERATION}" in
c) create_or_activate;;
r) remove;;
esac
# vim: set ft=sh