mirror of
https://git.decapod.one/brethil/dotfiles
synced 2024-11-22 03:21:30 +01:00
zsh: improve mkvenv function
This commit is contained in:
parent
bef37c3601
commit
21d9660e64
|
@ -354,12 +354,15 @@ make_backup() {
|
||||||
}
|
}
|
||||||
|
|
||||||
mkvenv(){
|
mkvenv(){
|
||||||
python -m venv .venv && echo "created venv: .venv"
|
# any arguments are passed on to the `venv` module as flags/arguments
|
||||||
|
if [[ -e .venv ]]; then
|
||||||
read -q source_venv
|
echo "$(color $RED Error:) $(color $BOLD .venv) already exists." >&2
|
||||||
|
return 1
|
||||||
if [[ $source_venv == "y" ]]; then
|
|
||||||
source .venv/bin/activate && echo "sourced venv"
|
|
||||||
fi
|
fi
|
||||||
|
echo -n "Creating venv..." && python -m venv $@ .venv && echo -n " done. Enable? [Y/n]"
|
||||||
|
read source_venv
|
||||||
|
|
||||||
|
if [[ $source_venv != "n" ]]; then
|
||||||
|
source .venv/bin/activate && echo -e " → $(color $BOLD Enabled!) 🐍 $(color $BOLD$PURPLE $(python --version | cut -d " " -f2 )) ($(color $BOLD$GREEN $(pip --version | cut -d " " -f -2)))"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user