|
|
@ -1527,6 +1527,7 @@ prompt_go_version() {
|
|
|
|
local -a match
|
|
|
|
local -a match
|
|
|
|
[[ $_p9k_ret == (#b)*go([[:digit:].]##)* ]] || return
|
|
|
|
[[ $_p9k_ret == (#b)*go([[:digit:].]##)* ]] || return
|
|
|
|
local v=$match[1]
|
|
|
|
local v=$match[1]
|
|
|
|
|
|
|
|
if (( _POWERLEVEL9K_GO_VERSION_PROJECT_ONLY )); then
|
|
|
|
local p=$GOPATH
|
|
|
|
local p=$GOPATH
|
|
|
|
if [[ -z $p ]]; then
|
|
|
|
if [[ -z $p ]]; then
|
|
|
|
if [[ -d $HOME/go ]]; then
|
|
|
|
if [[ -d $HOME/go ]]; then
|
|
|
@ -1535,13 +1536,15 @@ prompt_go_version() {
|
|
|
|
p="$(go env GOPATH 2>/dev/null)" && [[ -n $p ]] || return
|
|
|
|
p="$(go env GOPATH 2>/dev/null)" && [[ -n $p ]] || return
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
if [[ $_p9k_pwd/ != $p/* ]]; then
|
|
|
|
if [[ $_p9k_pwd/ != $p/* && $_p9k_pwd_a/ != $p/* ]]; then
|
|
|
|
local dir=$_p9k_pwd
|
|
|
|
local dir=$_p9k_pwd_a
|
|
|
|
while [[ ! -e $dir/go.mod ]]; do
|
|
|
|
while true; do
|
|
|
|
[[ $dir == / ]] && return
|
|
|
|
[[ $dir == / ]] && return
|
|
|
|
|
|
|
|
[[ -e $dir/go.mod ]] && break
|
|
|
|
dir=${dir:h}
|
|
|
|
dir=${dir:h}
|
|
|
|
done
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
fi
|
|
|
|
_p9k_prompt_segment "$0" "green" "grey93" "GO_ICON" 0 '' "${v//\%/%%}"
|
|
|
|
_p9k_prompt_segment "$0" "green" "grey93" "GO_ICON" 0 '' "${v//\%/%%}"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -1821,7 +1824,7 @@ prompt_nodenv() {
|
|
|
|
(( $+commands[nodenv] )) || return
|
|
|
|
(( $+commands[nodenv] )) || return
|
|
|
|
_p9k_ret=$NODENV_VERSION
|
|
|
|
_p9k_ret=$NODENV_VERSION
|
|
|
|
if [[ -z $_p9k_ret ]]; then
|
|
|
|
if [[ -z $_p9k_ret ]]; then
|
|
|
|
[[ $NODENV_DIR == /* ]] && local dir=$NODENV_DIR || local dir="$_p9k_pwd/$NODENV_DIR"
|
|
|
|
[[ $NODENV_DIR == /* ]] && local dir=$NODENV_DIR || local dir="$_p9k_pwd_a/$NODENV_DIR"
|
|
|
|
while [[ $dir != //[^/]# ]]; do
|
|
|
|
while [[ $dir != //[^/]# ]]; do
|
|
|
|
_p9k_read_nodenv_version_file $dir/.node-version && break
|
|
|
|
_p9k_read_nodenv_version_file $dir/.node-version && break
|
|
|
|
[[ $dir == / ]] && break
|
|
|
|
[[ $dir == / ]] && break
|
|
|
@ -1909,7 +1912,7 @@ prompt_rbenv() {
|
|
|
|
(( $+commands[rbenv] )) || return
|
|
|
|
(( $+commands[rbenv] )) || return
|
|
|
|
local v=$RBENV_VERSION
|
|
|
|
local v=$RBENV_VERSION
|
|
|
|
if [[ -z $v ]]; then
|
|
|
|
if [[ -z $v ]]; then
|
|
|
|
[[ $RBENV_DIR == /* ]] && local dir=$RBENV_DIR || local dir="$_p9k_pwd/$RBENV_DIR"
|
|
|
|
[[ $RBENV_DIR == /* ]] && local dir=$RBENV_DIR || local dir="$_p9k_pwd_a/$RBENV_DIR"
|
|
|
|
while true; do
|
|
|
|
while true; do
|
|
|
|
if _p9k_read_rbenv_version_file $dir/.ruby-version; then
|
|
|
|
if _p9k_read_rbenv_version_file $dir/.ruby-version; then
|
|
|
|
v=$_p9k_ret
|
|
|
|
v=$_p9k_ret
|
|
|
@ -1956,11 +1959,14 @@ prompt_rust_version() {
|
|
|
|
_p9k_cached_cmd_stdout rustc --version || return
|
|
|
|
_p9k_cached_cmd_stdout rustc --version || return
|
|
|
|
local v=${${_p9k_ret#rustc }%% *}
|
|
|
|
local v=${${_p9k_ret#rustc }%% *}
|
|
|
|
[[ -n $v ]] || return
|
|
|
|
[[ -n $v ]] || return
|
|
|
|
|
|
|
|
if (( _POWERLEVEL9K_RUST_VERSION_PROJECT_ONLY )); then
|
|
|
|
local dir=$_p9k_pwd_a
|
|
|
|
local dir=$_p9k_pwd_a
|
|
|
|
while [[ ! -e $dir/Cargo.toml ]]; do
|
|
|
|
while true; do
|
|
|
|
[[ $dir == / ]] && return
|
|
|
|
[[ $dir == / ]] && return
|
|
|
|
|
|
|
|
[[ -e $dir/Cargo.toml ]] && break
|
|
|
|
dir=${dir:h}
|
|
|
|
dir=${dir:h}
|
|
|
|
done
|
|
|
|
done
|
|
|
|
|
|
|
|
fi
|
|
|
|
_p9k_prompt_segment "$0" "darkorange" "$_p9k_color1" 'RUST_ICON' 0 '' "${v//\%/%%}"
|
|
|
|
_p9k_prompt_segment "$0" "darkorange" "$_p9k_color1" 'RUST_ICON' 0 '' "${v//\%/%%}"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -2744,7 +2750,7 @@ prompt_pyenv() {
|
|
|
|
(( $+commands[pyenv] )) || return
|
|
|
|
(( $+commands[pyenv] )) || return
|
|
|
|
local v=${(j.:.)${(@)${(s.:.)PYENV_VERSION}#python-}}
|
|
|
|
local v=${(j.:.)${(@)${(s.:.)PYENV_VERSION}#python-}}
|
|
|
|
if [[ -z $v ]]; then
|
|
|
|
if [[ -z $v ]]; then
|
|
|
|
[[ $PYENV_DIR == /* ]] && local dir=$PYENV_DIR || local dir="$_p9k_pwd/$PYENV_DIR"
|
|
|
|
[[ $PYENV_DIR == /* ]] && local dir=$PYENV_DIR || local dir="$_p9k_pwd_a/$PYENV_DIR"
|
|
|
|
while true; do
|
|
|
|
while true; do
|
|
|
|
if _p9k_read_pyenv_version_file $dir/.python-version; then
|
|
|
|
if _p9k_read_pyenv_version_file $dir/.python-version; then
|
|
|
|
v=$_p9k_ret
|
|
|
|
v=$_p9k_ret
|
|
|
@ -3614,6 +3620,8 @@ _p9k_init_params() {
|
|
|
|
_p9k_declare -i POWERLEVEL9K_LOAD_WHICH 5
|
|
|
|
_p9k_declare -i POWERLEVEL9K_LOAD_WHICH 5
|
|
|
|
_p9k_declare -b POWERLEVEL9K_NODENV_PROMPT_ALWAYS_SHOW 0
|
|
|
|
_p9k_declare -b POWERLEVEL9K_NODENV_PROMPT_ALWAYS_SHOW 0
|
|
|
|
_p9k_declare -b POWERLEVEL9K_NODE_VERSION_PROJECT_ONLY 0
|
|
|
|
_p9k_declare -b POWERLEVEL9K_NODE_VERSION_PROJECT_ONLY 0
|
|
|
|
|
|
|
|
_p9k_declare -b POWERLEVEL9K_GO_VERSION_PROJECT_ONLY 1
|
|
|
|
|
|
|
|
_p9k_declare -b POWERLEVEL9K_RUST_VERSION_PROJECT_ONLY 1
|
|
|
|
_p9k_declare -b POWERLEVEL9K_RBENV_PROMPT_ALWAYS_SHOW 0
|
|
|
|
_p9k_declare -b POWERLEVEL9K_RBENV_PROMPT_ALWAYS_SHOW 0
|
|
|
|
_p9k_declare -b POWERLEVEL9K_RVM_SHOW_GEMSET 0
|
|
|
|
_p9k_declare -b POWERLEVEL9K_RVM_SHOW_GEMSET 0
|
|
|
|
_p9k_declare -b POWERLEVEL9K_RVM_SHOW_PREFIX 0
|
|
|
|
_p9k_declare -b POWERLEVEL9K_RVM_SHOW_PREFIX 0
|
|
|
|