1
0
Fork 0
mirror of https://github.com/romkatv/powerlevel10k.git synced 2024-12-17 21:30:07 +00:00

added check for nvm command before running

This commit is contained in:
rjorgenson 2016-01-14 11:05:26 -07:00
parent 0639e1132c
commit 9aeff8d43b

View file

@ -531,10 +531,12 @@ prompt_node_version() {
# Node version from NVM
# Only prints the segment if different than the default value
prompt_nvm() {
local node_version=$(nvm current)
local nvm_default=$(cat $NVM_DIR/alias/default)
[[ -z "${node_version}" ]] && return
[[ "$node_version" =~ "$nvm_default" ]] && return
if [[ $(type nvm) =~ 'nvm is a shell function'* ]]; then
local node_version=$(nvm current)
local nvm_default=$(cat $NVM_DIR/alias/default)
[[ -z "${node_version}" ]] && return
[[ "$node_version" =~ "$nvm_default" ]] && return
fi
$1_prompt_segment "$0" "$2" "green" "011" "${node_version:1}" 'NODE_ICON'
}