Browse Source

Check if we need to update before updating

pull/5/head
Luke Childs 8 years ago
parent
commit
eb40361f00
  1. 15
      zsh-nvm.plugin.zsh

15
zsh-nvm.plugin.zsh

@ -27,13 +27,18 @@ _zsh_nvm_install() {
}
nvm_update() {
cd "$NVM_DIR"
echo "Checking latest version of nvm..."
local installed_version=$(git describe --tags)
local latest_version=$(_zsh_nvm_latest_release_tag)
echo "Latest version is $latest_version"
echo "Fetching updates..."
cd "$NVM_DIR"
git fetch
git checkout "$latest_version"
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 checkout "$latest_version"
fi
}
# Install nvm if it isn't already installed

Loading…
Cancel
Save