andresgongora / synth-shell-prompt

Customize your terminal with colors, extra system information, and eyecandy
GNU General Public License v3.0
40 stars 20 forks source link

Use actual python virtual environment name #27

Closed hmiladhia closed 2 years ago

hmiladhia commented 2 years ago

When creating a python environment, you can explicitly specify a name:

python -m venv .venv --prompt environment_name

In this case, the environment name is environment_name and not the directory name .venv.

In this PR, I attempt to retrieve the actual environment name from the .venv/bin/activate bash script using regex, if it fails revert to the directory name.

andresgongora commented 2 years ago

Hi @hmiladhia, thanks for your contribution!

I only had a quick look at the proposed changes, so please correct me if I have it wrong: you create an auxiliary variable named REGEX to keep the code clean, right? Said variable is therefore only used in that snippet of code. If so, please declare it local and (if I remember the coding style right) change it to lower case lettering to visually separate it from environment variables.

It's nice seeing new contributors! Remember to add yourself to the authors file if you like with a quick description of your contribution :) https://github.com/andresgongora/synth-shell-prompt/blob/master/AUTHORS.md

hmiladhia commented 2 years ago

Hi @andresgongora, thank your for your feedback !

I adjusted the regex variable naming style and declared it as local ✌🏼.