Skip to content

Commit

Permalink
Fix broken Python when not installed
Browse files Browse the repository at this point in the history
  • Loading branch information
knyazer authored Dec 22, 2024
1 parent 44c521a commit 769ba8b
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions functions/_tide_item_python.fish
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ function _tide_item_python
if test -n "$VIRTUAL_ENV"
if command -q python3
python3 --version | string match -qr "(?<v>[\d.]+)"
else
else if command -q python
python --version | string match -qr "(?<v>[\d.]+)"
end
else
return
end
string match -qr "^.*/(?<dir>.*)/(?<base>.*)" $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.
Expand All @@ -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 "(?<v>[\d.]+)"
else
else if command -q python
python --version | string match -qr "(?<v>[\d.]+)"
else
return
end
_tide_print_item python $tide_python_icon' ' $v
end
Expand Down

0 comments on commit 769ba8b

Please sign in to comment.