#777 Add POWERLEVEL9K_RBENV_PROMPT_ALWAYS_SHOW variable to display prompt_rbenv if rbenv_version_name is the same as rbenv_global

This commit is contained in:
Ryan Davidson 2018-04-03 13:52:13 +01:00
parent afb7387abe
commit 9f7b0b7404

View file

@ -1065,14 +1065,15 @@ prompt_ram() {
"$1_prompt_segment" "$0" "$2" "yellow" "$DEFAULT_COLOR" "$(printSizeHumanReadable "$ramfree" $base)" 'RAM_ICON' "$1_prompt_segment" "$0" "$2" "yellow" "$DEFAULT_COLOR" "$(printSizeHumanReadable "$ramfree" $base)" 'RAM_ICON'
} }
set_default POWERLEVEL9K_RBENV_PROMPT_ALWAYS_SHOW false
# rbenv information # rbenv information
prompt_rbenv() { prompt_rbenv() {
if which rbenv 2>/dev/null >&2; then if command which rbenv 2>/dev/null >&2; then
local rbenv_version_name="$(rbenv version-name)" local rbenv_version_name="$(rbenv version-name)"
local rbenv_global="$(rbenv global)" local rbenv_global="$(rbenv global)"
# Don't show anything if the current Ruby is the same as the global Ruby. # Don't show anything if the current Ruby is the same as the global Ruby.
if [[ $rbenv_version_name == $rbenv_global ]]; then if [[ $rbenv_version_name == $rbenv_global && "$POWERLEVEL9K_RBENV_PROMPT_ALWAYS_SHOW" = false ]]; then
return return
fi fi