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:
parent
0639e1132c
commit
9aeff8d43b
1 changed files with 6 additions and 4 deletions
|
@ -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'
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue