From e7390a860374fb38dd7bf67242ec12e8a6925a80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Sun, 26 Dec 2021 19:34:30 +0100 Subject: [PATCH] fix(jenv): quote % in `jenv_prompt_info` --- plugins/jenv/jenv.plugin.zsh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/plugins/jenv/jenv.plugin.zsh b/plugins/jenv/jenv.plugin.zsh index 946ce18a5..240102604 100644 --- a/plugins/jenv/jenv.plugin.zsh +++ b/plugins/jenv/jenv.plugin.zsh @@ -18,13 +18,19 @@ if [[ $FOUND_JENV -eq 1 ]]; then (( $+commands[jenv] )) || export PATH="${jenvdir}/bin:$PATH" eval "$(jenv init - zsh)" - function jenv_prompt_info() { jenv version-name 2>/dev/null } + function jenv_prompt_info() { + local version="$(jenv version-name 2>/dev/null)" + echo "${version:gs/%/%%}" + } if [[ -d "${jenvdir}/versions" ]]; then export JENV_ROOT=$jenvdir fi else - function jenv_prompt_info() { echo "system: $(java -version 2>&1 | cut -f 2 -d ' ')" } + function jenv_prompt_info() { + local version="$(java -version 2>&1 | cut -d' ' -f2)" + echo "system: ${version:gs/%/%%}" + } fi unset jenvdir jenvdirs FOUND_JENV