-
-
Notifications
You must be signed in to change notification settings - Fork 749
(theme/dulcie) Add virtual environment information to dulcie theme #715
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
The dulcie theme doesn't support showing the conda/python virtual environment information. I modified the `dulcie.theme.sh` file to add the feature to the dulcie theme
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
|||||||||||||||||
…olor reset sequence. The high-level issue suggested by the bot is not implemented because it is not working from my test. It will create errors when detecting venv
|
#714 This pull request aims to solve this closed issue before. |
| # [ritola@localhost ~]$ cd .bash-it/themes/dulcie | ||
| # [ritola@localhost |master ✓| dulcie]$ # This is single line mode | ||
| # |bash-it|± master ✓| | ||
| # [ritola@localhost dulcie]$ # In multi line, the SCM info is in the separate line |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why were they removed? Are there problems with these descriptions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want to apologize for it. No problem for these descriptions. My initial intention was to make my codes run but ignore the fact that I need to ensure I only made minimal and meaningful changes to the original codebase. I added them back in my new commit.
themes/dulcie/dulcie.theme.sh
Outdated
| DULCIE_MULTILINE=${DULCIE_MULTILINE:=1} # 0 = Single line, 1 = SCM in separate line | ||
|
|
||
| # Configuration for Python/Conda virtual environments | ||
| OMB_PROMPT_SHOW_PYTHON_VENV=${OMB_PROMPT_SHOW_PYTHON_VENV:=true} # Keep this for consistency |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| OMB_PROMPT_SHOW_PYTHON_VENV=${OMB_PROMPT_SHOW_PYTHON_VENV:=true} # Keep this for consistency | |
| OMB_PROMPT_SHOW_PYTHON_VENV=${OMB_PROMPT_SHOW_PYTHON_VENV:=false} # Keep this for consistency |
This line is usually put to keep the old behavior for existing users. We haven't been showing the Python environment information in the prompt, so we should keep the default behavior to be not showing it and let the user opt-in the Python environment information by setting OMB_PROMPT_SHOW_PYTHON_VENV in ~/.bashrc explicitly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed! now the default is false.
themes/dulcie/dulcie.theme.sh
Outdated
| echo -en "\[\e[48;5;${1}m\]" | ||
| } | ||
|
|
||
| function _dulcie_get_venv_name() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OMB_PROMPT_SHOW_PYTHON_VENV is meant for the prompt segment generated by _omb_prompt_get_python_venv():
oh-my-bash/lib/omb-prompt-base.sh
Lines 522 to 524 in 63ebf65
| function _omb_prompt_get_python_venv { | |
| python_venv= | |
| [[ ${OMB_PROMPT_SHOW_PYTHON_VENV-} == true ]] || return 1 |
Please use _omb_prompt_get_python_venv instead of defining a function doing the same thing as the existing one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed! the customized function was deleted.
themes/dulcie/dulcie.theme.sh
Outdated
| fi | ||
| else | ||
| SCM_THEME_PROMPT_PREFIX=" ${DULCIE_SCM_BACKGROUND}|${DULCIE_SCM_DIR_COLOR}" | ||
| SCM_THEME_PROMPT_PREFIX=" |${DULCIE_SCM_DIR_COLOR}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was this removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed. It should not be removed. I added them back
themes/dulcie/dulcie.theme.sh
Outdated
| SCM_THEME_PROMPT_PREFIX=" |${DULCIE_SCM_DIR_COLOR}" | ||
| SCM_THEME_PROMPT_SUFFIX="|${_omb_prompt_normal}" | ||
| PS1="${_omb_prompt_reset_color}[${DULCIE_USER}@${DULCIE_HOST}$(scm_prompt_info)${_omb_prompt_reset_color} ${DULCIE_WORKINGDIR}]" | ||
| PS1="${_omb_prompt_reset_color}[${python_env_prompt}${DULCIE_USER}@${DULCIE_HOST} ${DULCIE_WORKINGDIR}$(scm_prompt_info)]"+PS1="${_omb_prompt_reset_color}[${python_env_prompt}${DULCIE_USER}@${DULCIE_HOST}${_omb_prompt_reset_color} ${DULCIE_WORKINGDIR}$(scm_prompt_info)]" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line is broken.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for pointing it out. I have fixed this code. No extra edits in addition to adding the venv info to the prompt.
…inal codes without changing anything else besides venv part
User description
The
dulcietheme doesn't support showing the conda/python virtual environment information. I modified thedulcie.theme.shfile to add the feature to thedulciethemeThe original

dulcietheme:The newer version of
dulcietheme:PR Type
Enhancement
Description
Add virtual environment display support to dulcie theme
Show conda/python environment names in prompt
Implement custom venv detection function
Update prompt formatting for both single/multi-line modes
Diagram Walkthrough
File Walkthrough
dulcie.theme.sh
Add virtual environment display functionalitythemes/dulcie/dulcie.theme.sh
_dulcie_get_venv_name()function to detect conda/python virtualenvironments
OMB_PROMPT_SHOW_PYTHON_VENVconfiguration variable_omb_theme_PROMPT_COMMANDto include virtual environment namein prompt
display venv info
SCM_THEME_PROMPT_DIRTY