zsh functions: add -s flag to mkvenv

pull/6/head
bretello 2022-05-03 10:16:05 +02:00
parent dff98b066f
commit f3bf033fb8
Signed by: brethil
GPG Key ID: 876AAC6290170FE7
1 changed files with 6 additions and 1 deletions

View File

@ -2,15 +2,20 @@ mkvenv(){
local source_venv
if [[ $1 == "-s" ]]; then
source_venv=y
shift
fi
# any arguments are passed on to the `venv` module as flags/arguments
if [[ -e .venv ]]; then
echo "$(color $RED Error:) $(color $BOLD .venv) already exists." >&2
return 1
fi
echo -n "Creating venv..." && python -m venv $@ .venv && echo -n " done. Enable? [Y/n]"
echo -n "Creating venv..." && python -m venv $@ .venv
if [[ -z ${source_venv} ]]; then
echo -n " done. Enable? [Y/n]"
read source_venv
else
echo ""
fi
if [[ $source_venv != "n" ]]; then