mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-05-29 04:53:17 +02:00
Refactor to Coding Style Guide
Reference of [Coding Style Guide](https://github.com/robbyrussell/oh-my-zsh/wiki/Coding-style-guide)
This commit is contained in:
parent
62377ab6cb
commit
62c1014f4d
1 changed files with 6 additions and 11 deletions
|
|
@ -11,29 +11,24 @@ load-nvmrc() {
|
||||||
local node_version="$(nvm version)"
|
local node_version="$(nvm version)"
|
||||||
local nvmrc_path="$(nvm_find_nvmrc)"
|
local nvmrc_path="$(nvm_find_nvmrc)"
|
||||||
|
|
||||||
if [ -n "$nvmrc_path" ]
|
if [ -n "$nvmrc_path" ]; then
|
||||||
then
|
|
||||||
local nvmrc_node_version=$(nvm version "$(cat "${nvmrc_path}")")
|
local nvmrc_node_version=$(nvm version "$(cat "${nvmrc_path}")")
|
||||||
|
|
||||||
if [ "$nvmrc_node_version" = "N/A" ]
|
if [ "$nvmrc_node_version" = "N/A" ]; then
|
||||||
then
|
|
||||||
nvm install
|
nvm install
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$nvmrc_node_version" != "$node_version" ]
|
if [ "$nvmrc_node_version" != "$node_version" ]; then
|
||||||
then
|
|
||||||
nvm use
|
nvm use
|
||||||
fi
|
fi
|
||||||
elif [ "$node_version" != "$(nvm version default)" ]
|
elif [ "$node_version" != "$(nvm version default)" ]; then
|
||||||
then
|
|
||||||
echo "Reverting to nvm default version"
|
echo "Reverting to nvm default version"
|
||||||
nvm use default
|
nvm use default
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
if [[ "$ZSH_NVM_AUTOLOAD" == "true" ]]
|
if [[ "$ZSH_NVM_AUTOLOAD" == "true" ]]; then
|
||||||
then
|
autoload -U add-zsh-hook
|
||||||
autoload -U add-zsh-hook
|
|
||||||
add-zsh-hook chpwd load-nvmrc
|
add-zsh-hook chpwd load-nvmrc
|
||||||
load-nvmrc
|
load-nvmrc
|
||||||
fi
|
fi
|
||||||
Loading…
Add table
Add a link
Reference in a new issue