mirror of
https://github.com/romkatv/powerlevel10k.git
synced 2024-11-16 09:50:06 +00:00
Merge pull request #610 from sjoeboo/rbenv_always
Add ability to always show rbenv prompt
This commit is contained in:
commit
9ab067bd62
2 changed files with 10 additions and 6 deletions
|
@ -509,7 +509,11 @@ This segment shows the version of Ruby being used when using `rbenv` to change y
|
||||||
It figures out the version being used by taking the output of the `rbenv version-name` command.
|
It figures out the version being used by taking the output of the `rbenv version-name` command.
|
||||||
|
|
||||||
* If `rbenv` is not in $PATH, nothing will be shown.
|
* 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.
|
* By default, if the current local Ruby version is the same as the global Ruby version, nothing will be shown. See the configuration variable, below, to modify this behavior.
|
||||||
|
|
||||||
|
Variable | Default Value | Description |
|
||||||
|
|----------|---------------|-------------|
|
||||||
|
|`POWERLEVEL9K_RBENV_ALWAYS`|'false'|Always show the `rbenv` segment, even if the local version matches the global.|
|
||||||
|
|
||||||
##### rspec_stats
|
##### rspec_stats
|
||||||
|
|
||||||
|
|
|
@ -1052,17 +1052,17 @@ prompt_ram() {
|
||||||
}
|
}
|
||||||
|
|
||||||
# rbenv information
|
# rbenv information
|
||||||
|
set_default POWERLEVEL9K_RBENV_ALWAYS false
|
||||||
prompt_rbenv() {
|
prompt_rbenv() {
|
||||||
if which rbenv 2>/dev/null >&2; then
|
if 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
|
# unless `POWERLEVEL9K_RBENV_ALWAYS` is set.
|
||||||
return
|
if [[ $POWERLEVEL9K_RBENV_ALWAYS == true || $rbenv_version_name != $rbenv_global ]];then
|
||||||
|
"$1_prompt_segment" "$0" "$2" "red" "$DEFAULT_COLOR" "$rbenv_version_name" 'RUBY_ICON'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
"$1_prompt_segment" "$0" "$2" "red" "$DEFAULT_COLOR" "$rbenv_version_name" 'RUBY_ICON'
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue