mirror of
https://github.com/romkatv/powerlevel10k.git
synced 2024-12-18 05:40:07 +00:00
reworked nvm check
Now the prompt segment just returns without doing anything if nvm is not present.
This commit is contained in:
parent
2fa7b1d08f
commit
446f46473b
1 changed files with 6 additions and 7 deletions
|
@ -531,14 +531,13 @@ prompt_node_version() {
|
||||||
# Node version from NVM
|
# Node version from NVM
|
||||||
# Only prints the segment if different than the default value
|
# Only prints the segment if different than the default value
|
||||||
prompt_nvm() {
|
prompt_nvm() {
|
||||||
if [[ $(type nvm) =~ 'nvm is a shell function'* ]]; then
|
[[ $(type nvm) =~ 'nvm is a shell function'* ]] && return
|
||||||
local node_version=$(nvm current)
|
local node_version=$(nvm current)
|
||||||
local nvm_default=$(cat $NVM_DIR/alias/default)
|
local nvm_default=$(cat $NVM_DIR/alias/default)
|
||||||
[[ -z "${node_version}" ]] && return
|
[[ -z "${node_version}" ]] && return
|
||||||
[[ "$node_version" =~ "$nvm_default" ]] && return
|
[[ "$node_version" =~ "$nvm_default" ]] && return
|
||||||
fi
|
|
||||||
|
|
||||||
[[ -n "${node_version}" ]] && $1_prompt_segment "$0" "$2" "green" "011" "${node_version:1}" 'NODE_ICON'
|
$1_prompt_segment "$0" "$2" "green" "011" "${node_version:1}" 'NODE_ICON'
|
||||||
}
|
}
|
||||||
|
|
||||||
# print a little OS icon
|
# print a little OS icon
|
||||||
|
|
Loading…
Reference in a new issue