From f3bf033fb85eafa6cf5bc535001e1b6d63e86f26 Mon Sep 17 00:00:00 2001 From: bretello Date: Tue, 3 May 2022 10:16:05 +0200 Subject: [PATCH] zsh functions: add -s flag to mkvenv --- functions/python.zsh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/functions/python.zsh b/functions/python.zsh index 75c9f62..9d7cbbd 100644 --- a/functions/python.zsh +++ b/functions/python.zsh @@ -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