From 6a693fd92828a437bc9f92ad245ed74692d4fad3 Mon Sep 17 00:00:00 2001 From: Eugene Oliveros Date: Sat, 16 Mar 2024 21:12:47 +0800 Subject: [PATCH 1/2] Handle virtualenv names without `-` --- functions/_tide_item_python.fish | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/_tide_item_python.fish b/functions/_tide_item_python.fish index 57f7075a..2e351703 100644 --- a/functions/_tide_item_python.fish +++ b/functions/_tide_item_python.fish @@ -9,7 +9,7 @@ function _tide_item_python # pipenv $VIRTUAL_ENV looks like /home/ilan/.local/share/virtualenvs/pipenv_project-EwRYuc3l # Detect whether we are using pipenv by looking for 'virtualenvs'. If so, remove the hash at the end. if test "$dir" = virtualenvs - string match -qr "(?.*)-.*" $base + string match -qr "(?[^/-]*)" $base _tide_print_item python $tide_python_icon' ' "$v ($base)" else if contains -- "$base" virtualenv venv .venv env # avoid generic names _tide_print_item python $tide_python_icon' ' "$v ($dir)" From fda58599c22ead464e1f9d6abfe85f66f2352f4e Mon Sep 17 00:00:00 2001 From: Eugene Oliveros Date: Thu, 4 Apr 2024 12:11:50 +0800 Subject: [PATCH 2/2] add additional test for projects under virtualenv --- tests/_tide_item_python.test.fish | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/_tide_item_python.test.fish b/tests/_tide_item_python.test.fish index 11760529..46514065 100644 --- a/tests/_tide_item_python.test.fish +++ b/tests/_tide_item_python.test.fish @@ -21,6 +21,9 @@ _python # CHECK:  3.11.5 (python_project) set -lx VIRTUAL_ENV /home/ilan/.local/share/virtualenvs/pipenv_project-EwRYuc3l _python # CHECK:  3.11.5 (pipenv_project) +set -lx VIRTUAL_ENV /home/ilan/.local/share/virtualenvs/pipenv_project +_python # CHECK:  3.11.5 (pipenv_project) + set -l python_directory (mktemp -d) cd $python_directory