1
0
Fork 0
mirror of https://github.com/romkatv/powerlevel10k.git synced 2024-11-25 13:30:07 +00:00

Properly escape all weird shit (e.g., quotes).

This reverts commit 194db2e429.
This commit is contained in:
romkatv 2019-06-20 13:34:20 +02:00
parent 8785fa1f25
commit d6826aa417

View file

@ -206,7 +206,7 @@ left_prompt_segment() {
shift 7 shift 7
local content="${(j::):-$style${^@}}" local content="${(j::):-$style${^@}}"
(( expand )) || content="\${(Q)\${:-${(qqq)content}}}" (( expand )) || content="\${(Q)\${:-${(qqq)${(q)content}}}}"
_P9K_PROMPT+="\${\${:-$cond}:+\${\${:-\${_P9K_C::=${content}}${_P9K_CACHE_VAL[3]}" _P9K_PROMPT+="\${\${:-$cond}:+\${\${:-\${_P9K_C::=${content}}${_P9K_CACHE_VAL[3]}"
(( has_icon )) && _P9K_PROMPT+='${${(%):-$_P9K_C%1(l. .x)}[-1]%x}' (( has_icon )) && _P9K_PROMPT+='${${(%):-$_P9K_C%1(l. .x)}[-1]%x}'
@ -288,7 +288,7 @@ right_prompt_segment() {
_p9k_escape_rcurly $style _p9k_escape_rcurly $style
local content="${(j::):-$_P9K_RETVAL${^@}}" local content="${(j::):-$_P9K_RETVAL${^@}}"
(( expand )) || content="\${(Q)\${:-${(qqq)content}}}" (( expand )) || content="\${(Q)\${:-${(qqq)${(q)content}}}}"
_P9K_PROMPT+="\${\${:-$cond}:+\${\${:-\${_P9K_C::=${content}}${_P9K_CACHE_VAL[3]}" _P9K_PROMPT+="\${\${:-$cond}:+\${\${:-\${_P9K_C::=${content}}${_P9K_CACHE_VAL[3]}"
(( has_icon )) && _P9K_PROMPT+='${${(%):-$_P9K_C%1(l. .x)}[-1]%x}' (( has_icon )) && _P9K_PROMPT+='${${(%):-$_P9K_C%1(l. .x)}[-1]%x}'
@ -317,7 +317,7 @@ prompt_anaconda() {
if [[ $POWERLEVEL9K_ANACONDA_SHOW_PYTHON_VERSION == true ]] && _p9k_python_version; then if [[ $POWERLEVEL9K_ANACONDA_SHOW_PYTHON_VERSION == true ]] && _p9k_python_version; then
msg="$_P9K_RETVAL " msg="$_P9K_RETVAL "
fi fi
msg+="$POWERLEVEL9K_ANACONDA_LEFT_DELIMITER${${${p:t}//\%/%%}//\\/\\\\}$POWERLEVEL9K_ANACONDA_RIGHT_DELIMITER" msg+="$POWERLEVEL9K_ANACONDA_LEFT_DELIMITER${${p:t}//\%/%%}$POWERLEVEL9K_ANACONDA_RIGHT_DELIMITER"
"$1_prompt_segment" "$0" "$2" "blue" "$DEFAULT_COLOR" 'PYTHON_ICON' 0 '' "$msg" "$1_prompt_segment" "$0" "$2" "blue" "$DEFAULT_COLOR" 'PYTHON_ICON' 0 '' "$msg"
} }
@ -326,7 +326,7 @@ prompt_anaconda() {
prompt_aws() { prompt_aws() {
local aws_profile="${AWS_PROFILE:-$AWS_DEFAULT_PROFILE}" local aws_profile="${AWS_PROFILE:-$AWS_DEFAULT_PROFILE}"
if [[ -n "$aws_profile" ]]; then if [[ -n "$aws_profile" ]]; then
"$1_prompt_segment" "$0" "$2" red white 'AWS_ICON' 0 '' "${${aws_profile//\%/%%}//\\/\\\\}" "$1_prompt_segment" "$0" "$2" red white 'AWS_ICON' 0 '' "${aws_profile//\%/%%}"
fi fi
} }
@ -335,7 +335,7 @@ prompt_aws() {
prompt_aws_eb_env() { prompt_aws_eb_env() {
[[ -r .elasticbeanstalk/config.yml ]] || return [[ -r .elasticbeanstalk/config.yml ]] || return
local v=${=$(command grep environment .elasticbeanstalk/config.yml 2>/dev/null)[2]} local v=${=$(command grep environment .elasticbeanstalk/config.yml 2>/dev/null)[2]}
[[ -n $v ]] && "$1_prompt_segment" "$0" "$2" black green 'AWS_EB_ICON' 0 '' "${${v//\%/%%}//\\/\\\\}" [[ -n $v ]] && "$1_prompt_segment" "$0" "$2" black green 'AWS_EB_ICON' 0 '' "${v//\%/%%}"
} }
################################################################ ################################################################
@ -586,7 +586,7 @@ prompt_public_ip() {
_p9k_parse_ip $POWERLEVEL9K_PUBLIC_IP_VPN_INTERFACE && icon='VPN_ICON' _p9k_parse_ip $POWERLEVEL9K_PUBLIC_IP_VPN_INTERFACE && icon='VPN_ICON'
fi fi
$1_prompt_segment "$0" "$2" "$DEFAULT_COLOR" "$DEFAULT_COLOR_INVERTED" "$icon" 0 '' "${${ip//\%/%%}//\\/\\\\}" $1_prompt_segment "$0" "$2" "$DEFAULT_COLOR" "$DEFAULT_COLOR_INVERTED" "$icon" 0 '' "${ip//\%/%%}"
} }
################################################################ ################################################################
@ -604,7 +604,7 @@ prompt_context() {
if [[ $user != $DEFAULT_USER ]]; then if [[ $user != $DEFAULT_USER ]]; then
content="${POWERLEVEL9K_CONTEXT_TEMPLATE}" content="${POWERLEVEL9K_CONTEXT_TEMPLATE}"
elif [[ $POWERLEVEL9K_ALWAYS_SHOW_USER == true ]]; then elif [[ $POWERLEVEL9K_ALWAYS_SHOW_USER == true ]]; then
content="${${user//\%/%%}//\\/\\\\}" content="${user//\%/%%}"
else else
return return
fi fi
@ -638,7 +638,7 @@ prompt_user() {
elif [[ -n "$SUDO_COMMAND" ]]; then elif [[ -n "$SUDO_COMMAND" ]]; then
"$1_prompt_segment" "${0}_SUDO" "$2" "${DEFAULT_COLOR}" yellow SUDO_ICON 0 '' "${POWERLEVEL9K_USER_TEMPLATE}" "$1_prompt_segment" "${0}_SUDO" "$2" "${DEFAULT_COLOR}" yellow SUDO_ICON 0 '' "${POWERLEVEL9K_USER_TEMPLATE}"
else else
"$1_prompt_segment" "${0}_DEFAULT" "$2" "${DEFAULT_COLOR}" yellow USER_ICON 0 '' "${${user//\%/%%}//\\/\\\\}" "$1_prompt_segment" "${0}_DEFAULT" "$2" "${DEFAULT_COLOR}" yellow USER_ICON 0 '' "${user//\%/%%}"
fi fi
} }
@ -918,7 +918,7 @@ prompt_dir() {
_p9k_foreground $_P9K_RETVAL _p9k_foreground $_P9K_RETVAL
style+=$_P9K_RETVAL style+=$_P9K_RETVAL
parts=("${(@)${(@)parts//\%/%%}//\\/\\\\}") parts=("${(@)parts//\%/%%}")
[[ $fake_first == 0 && $parts[1] == '~' ]] && parts[1]=$POWERLEVEL9K_HOME_FOLDER_ABBREVIATION$style [[ $fake_first == 0 && $parts[1] == '~' ]] && parts[1]=$POWERLEVEL9K_HOME_FOLDER_ABBREVIATION$style
[[ $POWERLEVEL9K_DIR_OMIT_FIRST_CHARACTER == true && $#parts > 1 && -n $parts[2] ]] && parts[1]=() [[ $POWERLEVEL9K_DIR_OMIT_FIRST_CHARACTER == true && $#parts > 1 && -n $parts[2] ]] && parts[1]=()
@ -948,7 +948,7 @@ prompt_dir() {
# Docker machine # Docker machine
prompt_docker_machine() { prompt_docker_machine() {
if [[ -n "$DOCKER_MACHINE_NAME" ]]; then if [[ -n "$DOCKER_MACHINE_NAME" ]]; then
"$1_prompt_segment" "$0" "$2" "magenta" "$DEFAULT_COLOR" 'SERVER_ICON' 0 '' "${${DOCKER_MACHINE_NAME//\%/%%}//\\/\\\\}" "$1_prompt_segment" "$0" "$2" "magenta" "$DEFAULT_COLOR" 'SERVER_ICON' 0 '' "${DOCKER_MACHINE_NAME//\%/%%}"
fi fi
} }
@ -975,7 +975,7 @@ prompt_go_version() {
dir=${dir:h} dir=${dir:h}
done done
fi fi
"$1_prompt_segment" "$0" "$2" "green" "grey93" "GO_ICON" 0 '' "${${v//\%/%%}//\\/\\\\}" "$1_prompt_segment" "$0" "$2" "green" "grey93" "GO_ICON" 0 '' "${v//\%/%%}"
} }
################################################################ ################################################################
@ -993,7 +993,7 @@ prompt_detect_virt() {
[[ "$(command ls -di /)" != "2 /" ]] && virt="chroot" [[ "$(command ls -di /)" != "2 /" ]] && virt="chroot"
fi fi
if [[ -n "${virt}" ]]; then if [[ -n "${virt}" ]]; then
"$1_prompt_segment" "$0" "$2" "$DEFAULT_COLOR" "yellow" '' 0 '' "${${virt//\%/%%}//\\/\\\\}" "$1_prompt_segment" "$0" "$2" "$DEFAULT_COLOR" "yellow" '' 0 '' "${virt//\%/%%}"
fi fi
} }
@ -1014,7 +1014,7 @@ prompt_icons_test() {
set_default POWERLEVEL9K_IP_INTERFACE "^[^ ]+" set_default POWERLEVEL9K_IP_INTERFACE "^[^ ]+"
prompt_ip() { prompt_ip() {
_p9k_parse_ip $POWERLEVEL9K_IP_INTERFACE || return _p9k_parse_ip $POWERLEVEL9K_IP_INTERFACE || return
"$1_prompt_segment" "$0" "$2" "cyan" "$DEFAULT_COLOR" 'NETWORK_ICON' 0 '' "${${_P9K_RETVAL//\%/%%}//\\/\\\\}" "$1_prompt_segment" "$0" "$2" "cyan" "$DEFAULT_COLOR" 'NETWORK_ICON' 0 '' "${_P9K_RETVAL//\%/%%}"
} }
################################################################ ################################################################
@ -1023,7 +1023,7 @@ set_default POWERLEVEL9K_VPN_IP_INTERFACE "tun"
# prompt if vpn active # prompt if vpn active
prompt_vpn_ip() { prompt_vpn_ip() {
_p9k_parse_ip $POWERLEVEL9K_VPN_IP_INTERFACE || return _p9k_parse_ip $POWERLEVEL9K_VPN_IP_INTERFACE || return
"$1_prompt_segment" "$0" "$2" "cyan" "$DEFAULT_COLOR" 'VPN_ICON' 0 '' "${${_P9K_RETVAL//\%/%%}//\\/\\\\}" "$1_prompt_segment" "$0" "$2" "cyan" "$DEFAULT_COLOR" 'VPN_ICON' 0 '' "${_P9K_RETVAL//\%/%%}"
} }
################################################################ ################################################################
@ -1033,7 +1033,7 @@ prompt_laravel_version() {
if [[ -n "${laravel_version}" && "${laravel_version}" =~ "Laravel Framework" ]]; then if [[ -n "${laravel_version}" && "${laravel_version}" =~ "Laravel Framework" ]]; then
# Strip out everything but the version # Strip out everything but the version
laravel_version="${laravel_version//Laravel Framework /}" laravel_version="${laravel_version//Laravel Framework /}"
"$1_prompt_segment" "$0" "$2" "maroon" "white" 'LARAVEL_ICON' 0 '' "${${laravel_version//\%/%%}//\\/\\\\}" "$1_prompt_segment" "$0" "$2" "maroon" "white" 'LARAVEL_ICON' 0 '' "${laravel_version//\%/%%}"
fi fi
} }
@ -1233,7 +1233,7 @@ prompt_nvm() {
[[ -n $NVM_DIR ]] && _p9k_nvm_ls_current || return [[ -n $NVM_DIR ]] && _p9k_nvm_ls_current || return
local current=$_P9K_RETVAL local current=$_P9K_RETVAL
! _p9k_nvm_ls_default || [[ $_P9K_RETVAL != $current ]] || return ! _p9k_nvm_ls_default || [[ $_P9K_RETVAL != $current ]] || return
$1_prompt_segment "$0" "$2" "magenta" "black" 'NODE_ICON' 0 '' "${${${current#v}//\%/%%}//\\/\\\\}" $1_prompt_segment "$0" "$2" "magenta" "black" 'NODE_ICON' 0 '' "${${current#v}//\%/%%}"
} }
################################################################ ################################################################
@ -1242,7 +1242,7 @@ prompt_nodeenv() {
if [[ -n "$NODE_VIRTUAL_ENV" ]]; then if [[ -n "$NODE_VIRTUAL_ENV" ]]; then
_p9k_cached_cmd_stdout node --version || return _p9k_cached_cmd_stdout node --version || return
local info="${_P9K_RETVAL}[${NODE_VIRTUAL_ENV:t}]" local info="${_P9K_RETVAL}[${NODE_VIRTUAL_ENV:t}]"
"$1_prompt_segment" "$0" "$2" "black" "green" 'NODE_ICON' 0 '' "${${info//\%/%%}//\\/\\\\}" "$1_prompt_segment" "$0" "$2" "black" "green" 'NODE_ICON' 0 '' "${info//\%/%%}"
fi fi
} }
@ -1260,7 +1260,7 @@ prompt_php_version() {
local -a match local -a match
[[ $_P9K_RETVAL == (#b)(*$'\n')#(PHP [[:digit:].]##)* ]] || return [[ $_P9K_RETVAL == (#b)(*$'\n')#(PHP [[:digit:].]##)* ]] || return
local v=$match[2] local v=$match[2]
"$1_prompt_segment" "$0" "$2" "fuchsia" "grey93" '' 0 '' "${${v//\%/%%}//\\/\\\\}" "$1_prompt_segment" "$0" "$2" "fuchsia" "grey93" '' 0 '' "${v//\%/%%}"
} }
################################################################ ################################################################
@ -1332,7 +1332,7 @@ prompt_rbenv() {
[[ $v == $_P9K_RETVAL ]] && return [[ $v == $_P9K_RETVAL ]] && return
fi fi
"$1_prompt_segment" "$0" "$2" "red" "$DEFAULT_COLOR" 'RUBY_ICON' 0 '' "${${v//\%/%%}//\\/\\\\}" "$1_prompt_segment" "$0" "$2" "red" "$DEFAULT_COLOR" 'RUBY_ICON' 0 '' "${v//\%/%%}"
} }
################################################################ ################################################################
@ -1345,7 +1345,7 @@ prompt_chruby() {
local v='' local v=''
[[ $POWERLEVEL9K_CHRUBY_SHOW_ENGINE == true ]] && v=$RUBY_ENGINE [[ $POWERLEVEL9K_CHRUBY_SHOW_ENGINE == true ]] && v=$RUBY_ENGINE
if [[ $POWERLEVEL9K_CHRUBY_SHOW_VERSION == true && -n $RUBY_VERSION ]] && v+=${v:+ }$RUBY_VERSION if [[ $POWERLEVEL9K_CHRUBY_SHOW_VERSION == true && -n $RUBY_VERSION ]] && v+=${v:+ }$RUBY_VERSION
"$1_prompt_segment" "$0" "$2" "red" "$DEFAULT_COLOR" 'RUBY_ICON' 0 '' "${${v//\%/%%}//\\/\\\\}" "$1_prompt_segment" "$0" "$2" "red" "$DEFAULT_COLOR" 'RUBY_ICON' 0 '' "${v//\%/%%}"
} }
################################################################ ################################################################
@ -1377,7 +1377,7 @@ prompt_rust_version() {
_p9k_cached_cmd_stdout rustc --version || return _p9k_cached_cmd_stdout rustc --version || return
local v=${${_P9K_RETVAL#rustc }%% *} local v=${${_P9K_RETVAL#rustc }%% *}
[[ -n $v ]] || return [[ -n $v ]] || return
"$1_prompt_segment" "$0" "$2" "darkorange" "$DEFAULT_COLOR" 'RUST_ICON' 0 '' "${${v//\%/%%}//\\/\\\\}" "$1_prompt_segment" "$0" "$2" "darkorange" "$DEFAULT_COLOR" 'RUST_ICON' 0 '' "${v//\%/%%}"
} }
# RSpec test ratio # RSpec test ratio
@ -1397,7 +1397,7 @@ prompt_rvm() {
[[ $GEM_HOME == *rvm* && $ruby_string != $rvm_path/bin/ruby ]] || return [[ $GEM_HOME == *rvm* && $ruby_string != $rvm_path/bin/ruby ]] || return
local v=${${${GEM_HOME:t}%%${rvm_gemset_separator:-@}*}#*-} local v=${${${GEM_HOME:t}%%${rvm_gemset_separator:-@}*}#*-}
[[ -n $v ]] || return [[ -n $v ]] || return
"$1_prompt_segment" "$0" "$2" "240" "$DEFAULT_COLOR" 'RUBY_ICON' 0 '' "${${v//\%/%%}//\\/\\\\}" "$1_prompt_segment" "$0" "$2" "240" "$DEFAULT_COLOR" 'RUBY_ICON' 0 '' "${v//\%/%%}"
} }
################################################################ ################################################################
@ -1524,7 +1524,7 @@ prompt_symfony2_tests() {
prompt_symfony2_version() { prompt_symfony2_version() {
if [[ -r app/bootstrap.php.cache ]]; then if [[ -r app/bootstrap.php.cache ]]; then
local v="${$(command grep -F " VERSION " app/bootstrap.php.cache 2>/dev/null)//[![:digit:].]}" local v="${$(command grep -F " VERSION " app/bootstrap.php.cache 2>/dev/null)//[![:digit:].]}"
"$1_prompt_segment" "$0" "$2" "grey35" "$DEFAULT_COLOR" 'SYMFONY_ICON' 0 '' "${${v//\%/%%}//\\/\\\\}" "$1_prompt_segment" "$0" "$2" "grey35" "$DEFAULT_COLOR" 'SYMFONY_ICON' 0 '' "${v//\%/%%}"
fi fi
} }
@ -1552,7 +1552,7 @@ set_default POWERLEVEL9K_TIME_FORMAT "%D{%H:%M:%S}"
prompt_time() { prompt_time() {
local t=$POWERLEVEL9K_TIME_FORMAT local t=$POWERLEVEL9K_TIME_FORMAT
[[ $POWERLEVEL9K_EXPERIMENTAL_TIME_REALTIME == true ]] || t=${(%)t} [[ $POWERLEVEL9K_EXPERIMENTAL_TIME_REALTIME == true ]] || t=${(%)t}
"$1_prompt_segment" "$0" "$2" "$DEFAULT_COLOR_INVERTED" "$DEFAULT_COLOR" "TIME_ICON" 0 '' "${${t//\%/%%}//\\/\\\\}" "$1_prompt_segment" "$0" "$2" "$DEFAULT_COLOR_INVERTED" "$DEFAULT_COLOR" "TIME_ICON" 0 '' "${t//\%/%%}"
} }
################################################################ ################################################################
@ -1561,7 +1561,7 @@ set_default POWERLEVEL9K_DATE_FORMAT "%D{%d.%m.%y}"
prompt_date() { prompt_date() {
local d=$POWERLEVEL9K_DATE_FORMAT local d=$POWERLEVEL9K_DATE_FORMAT
[[ $POWERLEVEL9K_EXPERIMENTAL_TIME_REALTIME == true ]] || d=${(%)d} [[ $POWERLEVEL9K_EXPERIMENTAL_TIME_REALTIME == true ]] || d=${(%)d}
"$1_prompt_segment" "$0" "$2" "$DEFAULT_COLOR_INVERTED" "$DEFAULT_COLOR" "DATE_ICON" 0 '' "${${d//\%/%%}//\\/\\\\}" "$1_prompt_segment" "$0" "$2" "$DEFAULT_COLOR_INVERTED" "$DEFAULT_COLOR" "DATE_ICON" 0 '' "${d//\%/%%}"
} }
################################################################ ################################################################
@ -1804,21 +1804,21 @@ function _p9k_vcs_render() {
if [[ -n $VCS_STATUS_LOCAL_BRANCH ]]; then if [[ -n $VCS_STATUS_LOCAL_BRANCH ]]; then
_p9k_get_icon VCS_BRANCH_ICON _p9k_get_icon VCS_BRANCH_ICON
_$0_fmt BRANCH "$ws$_P9K_RETVAL${${VCS_STATUS_LOCAL_BRANCH//\%/%%}//\\/\\\\}" _$0_fmt BRANCH "$ws$_P9K_RETVAL${VCS_STATUS_LOCAL_BRANCH//\%/%%}"
fi fi
if [[ $POWERLEVEL9K_VCS_HIDE_TAGS == false && -n $VCS_STATUS_TAG ]]; then if [[ $POWERLEVEL9K_VCS_HIDE_TAGS == false && -n $VCS_STATUS_TAG ]]; then
_p9k_get_icon VCS_TAG_ICON _p9k_get_icon VCS_TAG_ICON
_$0_fmt TAG " $_P9K_RETVAL${${VCS_STATUS_TAG//\%/%%}//\\/\\\\}" _$0_fmt TAG " $_P9K_RETVAL${VCS_STATUS_TAG//\%/%%}"
fi fi
if [[ -n $VCS_STATUS_ACTION ]]; then if [[ -n $VCS_STATUS_ACTION ]]; then
_$0_fmt ACTION " | ${${VCS_STATUS_ACTION//\%/%%}//\\/\\\\}" _$0_fmt ACTION " | ${VCS_STATUS_ACTION//\%/%%}"
else else
if [[ -n $VCS_STATUS_REMOTE_BRANCH && if [[ -n $VCS_STATUS_REMOTE_BRANCH &&
$VCS_STATUS_LOCAL_BRANCH != $VCS_STATUS_REMOTE_BRANCH ]]; then $VCS_STATUS_LOCAL_BRANCH != $VCS_STATUS_REMOTE_BRANCH ]]; then
_p9k_get_icon VCS_REMOTE_BRANCH_ICON _p9k_get_icon VCS_REMOTE_BRANCH_ICON
_$0_fmt REMOTE_BRANCH " $_P9K_RETVAL${${VCS_STATUS_REMOTE_BRANCH//\%/%%}//\\/\\\\}" _$0_fmt REMOTE_BRANCH " $_P9K_RETVAL${VCS_STATUS_REMOTE_BRANCH//\%/%%}"
fi fi
if [[ $VCS_STATUS_HAS_STAGED == 1 ]]; then if [[ $VCS_STATUS_HAS_STAGED == 1 ]]; then
_p9k_get_icon VCS_STAGED_ICON _p9k_get_icon VCS_STAGED_ICON
@ -1980,7 +1980,7 @@ prompt_virtualenv() {
if [[ $POWERLEVEL9K_VIRTUALENV_SHOW_PYTHON_VERSION == true ]] && _p9k_python_version; then if [[ $POWERLEVEL9K_VIRTUALENV_SHOW_PYTHON_VERSION == true ]] && _p9k_python_version; then
msg="$_P9K_RETVAL " msg="$_P9K_RETVAL "
fi fi
msg+=${${${VIRTUAL_ENV:t}//\%/%%}//\\/\\\\} msg+=${${VIRTUAL_ENV:t}//\%/%%}
"$1_prompt_segment" "$0" "$2" "blue" "$DEFAULT_COLOR" 'PYTHON_ICON' 0 '' "$msg" "$1_prompt_segment" "$0" "$2" "blue" "$DEFAULT_COLOR" 'PYTHON_ICON' 0 '' "$msg"
} }
@ -2023,7 +2023,7 @@ prompt_pyenv() {
[[ $v == $_P9K_RETVAL ]] && return [[ $v == $_P9K_RETVAL ]] && return
fi fi
"$1_prompt_segment" "$0" "$2" "blue" "$DEFAULT_COLOR" 'PYTHON_ICON' 0 '' "${${v//\%/%%}//\\/\\\\}" "$1_prompt_segment" "$0" "$2" "blue" "$DEFAULT_COLOR" 'PYTHON_ICON' 0 '' "${v//\%/%%}"
} }
################################################################ ################################################################
@ -2032,9 +2032,9 @@ prompt_openfoam() {
local wm_project_version="$WM_PROJECT_VERSION" local wm_project_version="$WM_PROJECT_VERSION"
local wm_fork="$WM_FORK" local wm_fork="$WM_FORK"
if [[ -n "$wm_project_version" && -z "$wm_fork" ]] ; then if [[ -n "$wm_project_version" && -z "$wm_fork" ]] ; then
"$1_prompt_segment" "$0" "$2" "yellow" "$DEFAULT_COLOR" '' 0 '' "OF: ${${${wm_project_version:t}//\%/%%}//\\/\\\\}" "$1_prompt_segment" "$0" "$2" "yellow" "$DEFAULT_COLOR" '' 0 '' "OF: ${${wm_project_version:t}//\%/%%}"
elif [[ -n "$wm_project_version" && -n "$wm_fork" ]] ; then elif [[ -n "$wm_project_version" && -n "$wm_fork" ]] ; then
"$1_prompt_segment" "$0" "$2" "yellow" "$DEFAULT_COLOR" '' 0 '' "F-X: ${${${wm_project_version:t}//\%/%%}//\\/\\\\}" "$1_prompt_segment" "$0" "$2" "yellow" "$DEFAULT_COLOR" '' 0 '' "F-X: ${${wm_project_version:t}//\%/%%}"
fi fi
} }
@ -2044,7 +2044,7 @@ prompt_swift_version() {
_p9k_cached_cmd_stdout swift --version || return _p9k_cached_cmd_stdout swift --version || return
emulate -L zsh && setopt extendedglob emulate -L zsh && setopt extendedglob
[[ $_P9K_RETVAL == (#b)[^[:digit:]]#([[:digit:].]##)* ]] || return [[ $_P9K_RETVAL == (#b)[^[:digit:]]#([[:digit:].]##)* ]] || return
"$1_prompt_segment" "$0" "$2" "magenta" "white" 'SWIFT_ICON' 0 '' "${${match[1]//\%/%%}//\\/\\\\}" "$1_prompt_segment" "$0" "$2" "magenta" "white" 'SWIFT_ICON' 0 '' "${match[1]//\%/%%}"
} }
################################################################ ################################################################
@ -2119,7 +2119,7 @@ prompt_kubecontext() {
fi fi
[[ -n $_P9K_CACHE_VAL[1] ]] || return [[ -n $_P9K_CACHE_VAL[1] ]] || return
$1_prompt_segment $0$_P9K_CACHE_VAL[2] $2 magenta white KUBERNETES_ICON 0 '' "${${_P9K_CACHE_VAL[1]//\%/%%}//\\/\\\\}" $1_prompt_segment $0$_P9K_CACHE_VAL[2] $2 magenta white KUBERNETES_ICON 0 '' "${_P9K_CACHE_VAL[1]//\%/%%}"
} }
################################################################ ################################################################
@ -2136,7 +2136,7 @@ prompt_dropbox() {
dropbox_status="" dropbox_status=""
fi fi
"$1_prompt_segment" "$0" "$2" "white" "blue" "DROPBOX_ICON" 0 '' "${${dropbox_status//\%/%%}//\\/\\\\}" "$1_prompt_segment" "$0" "$2" "white" "blue" "DROPBOX_ICON" 0 '' "${dropbox_status//\%/%%}"
fi fi
} }
@ -2155,7 +2155,7 @@ prompt_java_version() {
v=${${v#*\"}%\"*} v=${${v#*\"}%\"*}
[[ $POWERLEVEL9K_JAVA_VERSION_FULL == true ]] || v=${v%%-*} [[ $POWERLEVEL9K_JAVA_VERSION_FULL == true ]] || v=${v%%-*}
[[ -n $v ]] || return [[ -n $v ]] || return
"$1_prompt_segment" "$0" "$2" "red" "white" "JAVA_ICON" 0 '' "${${v//\%/%%}//\\/\\\\}" "$1_prompt_segment" "$0" "$2" "red" "white" "JAVA_ICON" 0 '' "${v//\%/%%}"
} }
################################################################ ################################################################