Files
zkldi_Tachi/dev/fish-plugins/tide/functions/_tide_item_python.fish
T
zk 593adb2717 feat: Dev Container (#1149)
* temporary dvctr

* start of work

* fix: timeouts in windows

* fish?

* feat: better, working stuff

* refactor: rename database-seeds to seeds/

* better

* fdsaf

* feat: don't let our container get owned by root

* fix: better user handling

* feat: falling asleep at my desk i yield to you what i have done

* feat: autoadminify

* docs: denote trickshot

* feat: open in browser on launch

* better seeds workings...

* fix: dont kill shell

* docs: mention dev/debs

* fix: whoops

* fix: make seeds load within the century

* feat: rest of the containerisation

* feat: new alias

* style: fix linter errors

* fix: bad call

* fix: better justfile
2024-08-17 15:01:40 +01:00

28 lines
1.2 KiB
Fish

function _tide_item_python
if test -n "$VIRTUAL_ENV"
if command -q python3
python3 --version | string match -qr "(?<v>[\d.]+)"
else
python --version | string match -qr "(?<v>[\d.]+)"
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.
if test "$dir" = virtualenvs
string match -qr "(?<base>.*)-.*" $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)"
else
_tide_print_item python $tide_python_icon' ' "$v ($base)"
end
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
python --version | string match -qr "(?<v>[\d.]+)"
end
_tide_print_item python $tide_python_icon' ' $v
end
end