diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..490dc76 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +previous_version diff --git a/zsh-nvm.plugin.zsh b/zsh-nvm.plugin.zsh index 99e5029..515377e 100644 --- a/zsh-nvm.plugin.zsh +++ b/zsh-nvm.plugin.zsh @@ -1,3 +1,5 @@ +ZSH_NVM_DIR=${0:a:h} + [[ -z "$NVM_DIR" ]] && NVM_DIR="$HOME/.nvm" _zsh_nvm_rename_function() { @@ -63,6 +65,7 @@ _zsh_nvm_upgrade() { echo "You're already up to date" else echo "Updating to $latest_version..." + echo "$installed_version" > "$ZSH_NVM_DIR/previous_version" $(cd "$NVM_DIR" && git fetch --quiet && git checkout "$latest_version") _zsh_nvm_load fi