aboutsummaryrefslogtreecommitdiff
path: root/files/.zsh/rc/S50_functions
diff options
context:
space:
mode:
authorAnton Bobov <anton@bobov.name>2024-02-21 00:01:07 +0500
committerAnton Bobov <anton@bobov.name>2024-02-21 00:01:07 +0500
commit80ddd8de4b14d0bb828d3b9686dc70536dd9e3fd (patch)
treea690f316adcaa49c45ea50bf0ebdfcbe74375669 /files/.zsh/rc/S50_functions
parent19b3096392fcc12cb177bd7f4d788b054349c7df (diff)
[zsh] Update modules
Diffstat (limited to 'files/.zsh/rc/S50_functions')
-rw-r--r--files/.zsh/rc/S50_functions9
1 files changed, 7 insertions, 2 deletions
diff --git a/files/.zsh/rc/S50_functions b/files/.zsh/rc/S50_functions
index f510bd3..b9f2a08 100644
--- a/files/.zsh/rc/S50_functions
+++ b/files/.zsh/rc/S50_functions
@@ -64,7 +64,8 @@ alias calc="noglob calc"
# Take from @garybernhardt
activate_virtualenv() {
local found_location=""
- for name in venv env ; do
+ local default_name=venv
+ for name in $default_name env ; do
for up in . ../.. ../../.. ; do
if [ -f "$up/$name/bin/activate" ] ; then
found_location="$up/$name/bin/activate"
@@ -78,7 +79,11 @@ activate_virtualenv() {
# create
read -r "answer?Virtualenv not found, create? "
if [[ "$answer" =~ ^[Yy]$ ]] ; then
- virtualenv venv
+ if command -v virtualenv>/dev/null ; then
+ virtualenv $default_name
+ else
+ python3 -m venv $default_name
+ fi
activate_virtualenv
fi
else