mirror of
https://git.decapod.one/brethil/dotfiles
synced 2024-12-22 15:21:30 +01:00
zsh: improve mkvenv function
This commit is contained in:
parent
bef37c3601
commit
21d9660e64
|
@ -354,12 +354,15 @@ make_backup() {
|
|||
}
|
||||
|
||||
mkvenv(){
|
||||
python -m venv .venv && echo "created venv: .venv"
|
||||
|
||||
read -q source_venv
|
||||
|
||||
if [[ $source_venv == "y" ]]; then
|
||||
source .venv/bin/activate && echo "sourced venv"
|
||||
# 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]"
|
||||
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