Skip to content
This repository has been archived by the owner on Apr 24, 2020. It is now read-only.

Commit

Permalink
Merge pull request #795 from ryandav/rbenv-prompt-option-always-displ…
Browse files Browse the repository at this point in the history
…ays-#777

Rbenv prompt option always displays #777
  • Loading branch information
bhilburn authored Apr 14, 2018
2 parents 0d8bfb6 + e85fb6c commit 13b0e38
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,10 @@ It figures out the version being used by taking the output of the `rbenv version
* If `rbenv` is not in $PATH, nothing will be shown.
* If the current Ruby version is the same as the global Ruby version, nothing will be shown.

| Variable | Default Value | Description |
|----------|---------------|-------------|
|`POWERLEVEL9K_RBENV_PROMPT_ALWAYS_SHOW`|`false`|Set to true if you wish to show the rbenv segment even if the current Ruby version is the same as the global Ruby version|

##### rspec_stats

See [Unit Test Ratios](#unit-test-ratios), below.
Expand Down
11 changes: 6 additions & 5 deletions powerlevel9k.zsh-theme
Original file line number Diff line number Diff line change
Expand Up @@ -1067,14 +1067,15 @@ prompt_ram() {
"$1_prompt_segment" "$0" "$2" "yellow" "$DEFAULT_COLOR" "$(printSizeHumanReadable "$ramfree" $base)" 'RAM_ICON'
}

set_default POWERLEVEL9K_RBENV_PROMPT_ALWAYS_SHOW false
# rbenv information
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_global="$(rbenv global)"

# 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
fi

Expand Down Expand Up @@ -1425,7 +1426,7 @@ prompt_kubecontext() {
if [[ -z "$k8s_namespace" ]]; then
k8s_namespace="default"
fi

local k8s_final_text=""

if [[ "$k8s_context" == "k8s_namespace" ]]; then
Expand All @@ -1434,8 +1435,8 @@ prompt_kubecontext() {
else
k8s_final_text="$k8s_context/$k8s_namespace"
fi


"$1_prompt_segment" "$0" "$2" "magenta" "white" "$k8s_final_text" "KUBERNETES_ICON"
fi
}
Expand Down

0 comments on commit 13b0e38

Please sign in to comment.