forked from extern/ohmyzsh
fix: quote % characters in ruby prompt info functions
This commit is contained in:
parent
59cb231692
commit
9a3d853481
@ -30,7 +30,7 @@ function rvm_prompt_info() {
|
|||||||
local rvm_prompt
|
local rvm_prompt
|
||||||
rvm_prompt=$($HOME/.rvm/bin/rvm-prompt ${=ZSH_THEME_RVM_PROMPT_OPTIONS} 2>/dev/null)
|
rvm_prompt=$($HOME/.rvm/bin/rvm-prompt ${=ZSH_THEME_RVM_PROMPT_OPTIONS} 2>/dev/null)
|
||||||
[[ -z "${rvm_prompt}" ]] && return 1
|
[[ -z "${rvm_prompt}" ]] && return 1
|
||||||
echo "${ZSH_THEME_RUBY_PROMPT_PREFIX}${rvm_prompt}${ZSH_THEME_RUBY_PROMPT_SUFFIX}"
|
echo "${ZSH_THEME_RUBY_PROMPT_PREFIX}${rvm_prompt:gs/%/%%}${ZSH_THEME_RUBY_PROMPT_SUFFIX}"
|
||||||
}
|
}
|
||||||
|
|
||||||
ZSH_THEME_RVM_PROMPT_OPTIONS="i v g"
|
ZSH_THEME_RVM_PROMPT_OPTIONS="i v g"
|
||||||
|
@ -73,7 +73,7 @@ function current_ruby() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function chruby_prompt_info() {
|
function chruby_prompt_info() {
|
||||||
echo "$(current_ruby)"
|
echo "${$(current_ruby):gs/%/%%}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Complete chruby command with installed rubies
|
# Complete chruby command with installed rubies
|
||||||
|
@ -47,7 +47,7 @@ if [[ $FOUND_RBENV -eq 1 ]]; then
|
|||||||
}
|
}
|
||||||
|
|
||||||
function rbenv_prompt_info() {
|
function rbenv_prompt_info() {
|
||||||
local ruby=$(current_ruby) gemset=$(current_gemset)
|
local ruby=${$(current_ruby):gs/%/%%} gemset=${$(current_gemset):gs/%/%%}
|
||||||
echo -n "${ZSH_THEME_RUBY_PROMPT_PREFIX}"
|
echo -n "${ZSH_THEME_RUBY_PROMPT_PREFIX}"
|
||||||
[[ -n "$gemset" ]] && echo -n "${ruby}@${gemset}" || echo -n "${ruby}"
|
[[ -n "$gemset" ]] && echo -n "${ruby}@${gemset}" || echo -n "${ruby}"
|
||||||
echo "${ZSH_THEME_RUBY_PROMPT_SUFFIX}"
|
echo "${ZSH_THEME_RUBY_PROMPT_SUFFIX}"
|
||||||
@ -60,7 +60,7 @@ else
|
|||||||
function gems() { echo "not supported" }
|
function gems() { echo "not supported" }
|
||||||
function rbenv_prompt_info() {
|
function rbenv_prompt_info() {
|
||||||
echo -n "${ZSH_THEME_RUBY_PROMPT_PREFIX}"
|
echo -n "${ZSH_THEME_RUBY_PROMPT_PREFIX}"
|
||||||
echo -n "system: $(ruby -v | cut -f-2 -d ' ')"
|
echo -n "system: $(ruby -v | cut -f-2 -d ' ' | sed 's/%/%%/g')"
|
||||||
echo "${ZSH_THEME_RUBY_PROMPT_SUFFIX}"
|
echo "${ZSH_THEME_RUBY_PROMPT_SUFFIX}"
|
||||||
}
|
}
|
||||||
fi
|
fi
|
||||||
|
@ -45,4 +45,5 @@ function rbfu-rubies() {
|
|||||||
|
|
||||||
# Public: Create rvm_prompt_info command for themes compatibility, unless
|
# Public: Create rvm_prompt_info command for themes compatibility, unless
|
||||||
# it has already been defined.
|
# it has already been defined.
|
||||||
[ ! -x rvm_prompt_info ] && function rvm_prompt_info() { echo "${RBFU_RUBY_VERSION:=system}" }
|
(( ${+functions[rvm_prompt_info]} )) || \
|
||||||
|
function rvm_prompt_info() { echo "${${RBFU_RUBY_VERSION:=system}:gs/%/%%}" }
|
||||||
|
Loading…
Reference in New Issue
Block a user