-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow nvm use
to be called with the part of the semver
#709
Allow nvm use
to be called with the part of the semver
#709
Conversation
@coreybutler any chance of reviewing this one? Thanks |
Not during the holiday break. |
@coreybutler any chance you get around to it? This utility is great, would be awesome to improve the usability here |
This PR is stale because it has been open 45 days with no activity. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good, except for the removed error handling. See comments for details.
@vladonemo have you had a chance to check out the comments above? I would love to see it merged! |
55850f2
to
d55a320
Compare
This PR is stale because it has been open 45 days with no activity. |
@coreybutler I have reverted the error handling changes long time back. Any chance merging this one? |
src/nvm.go
Outdated
func findLatestSubVersion(version string, localOnly ...bool) string { | ||
if len(localOnly) > 0 && localOnly[0] { | ||
installed := node.GetInstalled(env.root) | ||
result := "" | ||
for _, v := range installed { | ||
if strings.HasPrefix(v, "v"+version) { | ||
if result != "" { | ||
current, _ := semver.New(strings.Replace(result, "v", "", 1)) | ||
next, _ := semver.New(strings.Replace(v, "v", "", 1)) | ||
current, _ := semver.New(versionNumberFrom(v)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be referring to the 'result' variable, instead of v like the result variable above?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, thanks a lot. Yep, right. Though it doesn't really matter in the context this piece of code is called - the list of versions is sorted descending, hence the first version in the list is always the latest one.
For instance, the `nvm use 12` will switch to the latest installed version of 12.*. Similarly, `nvm use 12.22` will switch to the latest installed version of 12.22.* Fixes coreybutler#708
d55a320
to
9f3af8a
Compare
@coreybutler I had to change the error handling mentioned above once more. After I added it back (on your request), the most important use cases of this feature PR stopped working (e.g. |
Can we get this or similar implemented soon? The command |
@coreybutler this PR has been open since half a year now. Is there any chance that it gets closed? I'd like to avoid distributing a patched version to our teams and use the official release instead. |
Merged. This will be in the next release, but there are several other PRs to review before I can cut a new release. |
For instance, the
nvm use 12
will switch to the latest installed version of 12.. Similarly,nvm use 12.22
will switch to the latest installed version of 12.22.Fixes #708