mirror of
https://github.com/romkatv/powerlevel10k.git
synced 2024-11-11 00:00:06 +00:00
Improve rbenv
as well
This commit is contained in:
parent
25e2064f0e
commit
9f09547ad1
1 changed files with 12 additions and 17 deletions
|
@ -1262,19 +1262,17 @@ prompt_ram() {
|
|||
|
||||
################################################################
|
||||
# Segment to display rbenv information
|
||||
# https://github.com/rbenv/rbenv#choosing-the-ruby-version
|
||||
set_default POWERLEVEL9K_RBENV_PROMPT_ALWAYS_SHOW false
|
||||
prompt_rbenv() {
|
||||
if [ $commands[rbenv] ]; then
|
||||
if [[ -n "$RBENV_VERSION" ]]; then
|
||||
"$1_prompt_segment" "$0" "$2" "red" "$DEFAULT_COLOR" "$RBENV_VERSION" 'RUBY_ICON'
|
||||
elif [ $commands[rbenv] ]; then
|
||||
local rbenv_version_name="$(rbenv version-name)"
|
||||
local rbenv_global="$(rbenv global)"
|
||||
|
||||
# Don't show anything if the current Ruby is the same as the global Ruby
|
||||
# unless `POWERLEVEL9K_RBENV_PROMPT_ALWAYS_SHOW` is set.
|
||||
if [[ $rbenv_version_name == $rbenv_global && "$POWERLEVEL9K_RBENV_PROMPT_ALWAYS_SHOW" = false ]]; then
|
||||
return
|
||||
if ! [[ $rbenv_version_name == $rbenv_global && "$POWERLEVEL9K_RBENV_PROMPT_ALWAYS_SHOW" = false ]]; then
|
||||
"$1_prompt_segment" "$0" "$2" "red" "$DEFAULT_COLOR" "$rbenv_version_name" 'RUBY_ICON'
|
||||
fi
|
||||
|
||||
"$1_prompt_segment" "$0" "$2" "red" "$DEFAULT_COLOR" "$rbenv_version_name" 'RUBY_ICON'
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -1632,15 +1630,12 @@ prompt_virtualenv() {
|
|||
# https://github.com/pyenv/pyenv#choosing-the-python-version
|
||||
set_default POWERLEVEL9K_PYENV_PROMPT_ALWAYS_SHOW false
|
||||
prompt_pyenv() {
|
||||
if [ $commands[pyenv] ]; then
|
||||
if [[ -n "$PYENV_VERSION" ]]; then
|
||||
"$1_prompt_segment" "$0" "$2" "blue" "$DEFAULT_COLOR" "$PYENV_VERSION" 'PYTHON_ICON'
|
||||
else
|
||||
local pyenv_version_name="$(pyenv version-name)"
|
||||
local pyenv_global="$(pyenv version-file-read $(pyenv root)/version)"
|
||||
if [[ $pyenv_version_name == $pyenv_global && "$POWERLEVEL9K_PYENV_PROMPT_ALWAYS_SHOW" = false ]]; then
|
||||
return
|
||||
fi
|
||||
if [[ -n "$PYENV_VERSION" ]]; then
|
||||
"$1_prompt_segment" "$0" "$2" "blue" "$DEFAULT_COLOR" "$PYENV_VERSION" 'PYTHON_ICON'
|
||||
elif [ $commands[pyenv] ]; then
|
||||
local pyenv_version_name="$(pyenv version-name)"
|
||||
local pyenv_global="$(pyenv version-file-read $(pyenv root)/version)"
|
||||
if ! [[ $pyenv_version_name == $pyenv_global && "$POWERLEVEL9K_PYENV_PROMPT_ALWAYS_SHOW" = false ]]; then
|
||||
"$1_prompt_segment" "$0" "$2" "blue" "$DEFAULT_COLOR" "$pyenv_version_name" 'PYTHON_ICON'
|
||||
fi
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue