ref(func/workon): if first argument is none - curdir -env name

This commit is contained in:
TheK4n 2022-01-04 22:24:49 +03:00
parent fbb4ad2c7c
commit 32bf69ccec

View File

@ -12,13 +12,14 @@ lsl () {
}
workon() {
local ENV_NAME
ENV_NAME="$1"
if [ -z "$1" ]; then
echo "workon: error: enter filename" >&2
return 2 # exit code
ENV_NAME=$(basename "$(pwd)")
fi
source /opt/pythonenv/"${1}"/bin/activate
source /opt/pythonenv/"$ENV_NAME"/bin/activate
}