From 80ddd8de4b14d0bb828d3b9686dc70536dd9e3fd Mon Sep 17 00:00:00 2001 From: Anton Bobov Date: Wed, 21 Feb 2024 00:01:07 +0500 Subject: [zsh] Update modules --- files/.zsh/rc/S50_functions | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'files/.zsh/rc') 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 -- cgit v1.2.3