mirror of
https://github.com/lukechilds/zsh-nvm.git
synced 2025-02-06 09:55:31 +08:00
Check if we need to update before updating
This commit is contained in:
parent
2babe68372
commit
eb40361f00
@ -27,13 +27,18 @@ _zsh_nvm_install() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
nvm_update() {
|
nvm_update() {
|
||||||
echo "Checking latest version of nvm..."
|
|
||||||
local latest_version=$(_zsh_nvm_latest_release_tag)
|
|
||||||
echo "Latest version is $latest_version"
|
|
||||||
echo "Fetching updates..."
|
|
||||||
cd "$NVM_DIR"
|
cd "$NVM_DIR"
|
||||||
|
echo "Checking latest version of nvm..."
|
||||||
|
local installed_version=$(git describe --tags)
|
||||||
|
local latest_version=$(_zsh_nvm_latest_release_tag)
|
||||||
|
echo "Installed version is $installed_version"
|
||||||
|
if [[ "$installed_version" = "$latest_version" ]]; then
|
||||||
|
echo "You're already up to date"
|
||||||
|
else
|
||||||
|
echo "Updating to $latest_version..."
|
||||||
git fetch
|
git fetch
|
||||||
git checkout "$latest_version"
|
git checkout "$latest_version"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Install nvm if it isn't already installed
|
# Install nvm if it isn't already installed
|
||||||
|
Loading…
Reference in New Issue
Block a user