1
0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2024-11-22 08:33:54 +08:00

fix: quote % characters in ruby prompt info functions

This commit is contained in:
Marc Cornellà 2021-12-13 17:43:32 +01:00
parent 59cb231692
commit 9a3d853481
No known key found for this signature in database
GPG Key ID: 0314585E776A9C1B
4 changed files with 6 additions and 5 deletions

View File

@ -30,7 +30,7 @@ function rvm_prompt_info() {
local rvm_prompt
rvm_prompt=$($HOME/.rvm/bin/rvm-prompt ${=ZSH_THEME_RVM_PROMPT_OPTIONS} 2>/dev/null)
[[ -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"

View File

@ -73,7 +73,7 @@ function current_ruby() {
}
function chruby_prompt_info() {
echo "$(current_ruby)"
echo "${$(current_ruby):gs/%/%%}"
}
# Complete chruby command with installed rubies

View File

@ -47,7 +47,7 @@ if [[ $FOUND_RBENV -eq 1 ]]; then
}
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}"
[[ -n "$gemset" ]] && echo -n "${ruby}@${gemset}" || echo -n "${ruby}"
echo "${ZSH_THEME_RUBY_PROMPT_SUFFIX}"
@ -60,7 +60,7 @@ else
function gems() { echo "not supported" }
function rbenv_prompt_info() {
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}"
}
fi

View File

@ -45,4 +45,5 @@ function rbfu-rubies() {
# Public: Create rvm_prompt_info command for themes compatibility, unless
# 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/%/%%}" }