From 769ba8b22f35d7db6a57fe793acf0c6e6ceea741 Mon Sep 17 00:00:00 2001 From: Roman Knyazhitskiy Date: Sun, 22 Dec 2024 19:30:37 +0100 Subject: [PATCH 1/2] Fix broken Python when not installed --- functions/_tide_item_python.fish | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/functions/_tide_item_python.fish b/functions/_tide_item_python.fish index 57f7075a..6c7dd247 100644 --- a/functions/_tide_item_python.fish +++ b/functions/_tide_item_python.fish @@ -2,9 +2,11 @@ function _tide_item_python if test -n "$VIRTUAL_ENV" if command -q python3 python3 --version | string match -qr "(?[\d.]+)" - else + else if command -q python python --version | string match -qr "(?[\d.]+)" - end + else + return + end string match -qr "^.*/(?.*)/(?.*)" $VIRTUAL_ENV # 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. @@ -19,8 +21,10 @@ function _tide_item_python else if path is .python-version Pipfile __init__.py pyproject.toml requirements.txt setup.py if command -q python3 python3 --version | string match -qr "(?[\d.]+)" - else + else if command -q python python --version | string match -qr "(?[\d.]+)" + else + return end _tide_print_item python $tide_python_icon' ' $v end From 45b6f9c8e9fd7564300f2dfac874ed19c344f803 Mon Sep 17 00:00:00 2001 From: Roman Knyazhitskiy Date: Mon, 23 Dec 2024 15:21:54 +0000 Subject: [PATCH 2/2] Fix formatting --- functions/_tide_item_python.fish | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/functions/_tide_item_python.fish b/functions/_tide_item_python.fish index 6c7dd247..e90ed602 100644 --- a/functions/_tide_item_python.fish +++ b/functions/_tide_item_python.fish @@ -4,9 +4,9 @@ function _tide_item_python python3 --version | string match -qr "(?[\d.]+)" else if command -q python python --version | string match -qr "(?[\d.]+)" - else - return - end + else + return + end string match -qr "^.*/(?.*)/(?.*)" $VIRTUAL_ENV # 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. @@ -23,8 +23,8 @@ function _tide_item_python python3 --version | string match -qr "(?[\d.]+)" else if command -q python python --version | string match -qr "(?[\d.]+)" - else - return + else + return end _tide_print_item python $tide_python_icon' ' $v end