ohmybash / oh-my-bash

A delightful community-driven framework for managing your bash configuration, and an auto-update tool so that makes it easy to keep up with the latest updates from the community.
https://ohmybash.github.io
MIT License
5.55k stars 626 forks source link

themes/agnoster : pyenv not properly detected/shown #458

Closed Epithumia closed 11 months ago

Epithumia commented 11 months ago

At the moment, agnoster relies on $VIRTUAL_ENV to detect virtualenvs, but it is unreliable when using pyenv. With a named pyenv virtualenv, it properly detects we are in a virtualenv, and sets the prompt as [v] <version>; when using a non-system version, it fails to detect the version ($VIRTUAL_ENV is not set) and hides the python segment.

Ideally (I think), pyenv should be treated and displayed somewhat like conda is: when a non system version is used, grab the python version, and when in a virtualenv, show its name and version.

This PR adds Pyenv detection to agnoster:

I'm not particularly proficient with bash, so the whole thing can probably be improved, but as far as I could test, it works. Since I don't use conda, it would likely require some extra testing to see how the two interact and check that it doesn't break the conda display.

Epithumia commented 11 months ago

I tested both suggestions, seems fine as far as I can tell, so I added both.

Epithumia commented 11 months ago

Thank you for the comments and suggestions. ^^