This commit is contained in:
parent
7e5d880156
commit
d93f63cf82
40 changed files with 448 additions and 649 deletions
|
|
@ -19,8 +19,18 @@ help() {
|
|||
}
|
||||
|
||||
|
||||
deactivate_or_unset() {
|
||||
if command -v deactivate >/dev/null 2>&1; then
|
||||
deactivate
|
||||
else
|
||||
unset VIRTUAL_ENV
|
||||
unset VIRTUAL_ENV_PROMPT
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
remove() {
|
||||
[ -n "${VIRTUAL_ENV}" ] && deactivate
|
||||
[ -n "${VIRTUAL_ENV}" ] && deactivate_or_unset
|
||||
rm -rf "${VENV_FOLDER}"
|
||||
}
|
||||
|
||||
|
|
@ -53,9 +63,9 @@ VENV_FOLDER="${VENV_FOLDER_PATH}/${VENV_FOLDER_NAME}"
|
|||
|
||||
# shellcheck disable=SC2015
|
||||
case "${OPERATION}" in
|
||||
c) [ -z "${VIRTUAL_ENV}" ] && create_or_activate || help >&2;;
|
||||
d) [ -n "${VIRTUAL_ENV}" ] && deactivate || help >&2;;
|
||||
r) [ -d "${VENV_FOLDER}" ] && remove || help >&2;;
|
||||
c) [ -z "${VIRTUAL_ENV}" ] && create_or_activate || help >&2;;
|
||||
d) [ -n "${VIRTUAL_ENV}" ] && deactivate_or_unset || help >&2;;
|
||||
r) [ -d "${VENV_FOLDER}" ] && remove || help >&2;;
|
||||
esac
|
||||
|
||||
# vim: ft=sh
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue