diff --git a/src/nvm.go b/src/nvm.go index 5a20396..db74966 100644 --- a/src/nvm.go +++ b/src/nvm.go @@ -19,6 +19,7 @@ import ( "nvm/node" "nvm/web" + "github.com/blang/semver" "github.com/olekukonko/tablewriter" ) @@ -104,6 +105,8 @@ func main() { fmt.Println(NvmVersion) case "v": fmt.Println(NvmVersion) + case "version": + fmt.Println(NvmVersion) case "arch": if strings.Trim(detail, " \r\n") != "" { detail = strings.Trim(detail, " \r\n") @@ -126,6 +129,18 @@ func main() { env.proxy = detail saveSettings() } + case "current": + inuse, _ := node.GetCurrentVersion() + v, _ := semver.Make(inuse) + err := v.Validate() + fmt.Println(err, inuse) + if err != nil { + fmt.Println(inuse) + } else if inuse == "Unknown" { + fmt.Println("No current version. Run 'nvm use x.x.x' to set a version.") + } else { + fmt.Println("v" + inuse) + } //case "update": update() case "node_mirror": @@ -601,6 +616,7 @@ func help() { fmt.Println("\nUsage:") fmt.Println(" ") fmt.Println(" nvm arch : Show if node is running in 32 or 64 bit mode.") + fmt.Println(" nvm current : Display active version.") fmt.Println(" nvm install [arch] : The version can be a specific version, \"latest\" for the latest current version, or \"lts\" for the") fmt.Println(" most recent LTS version. Optionally specify whether to install the 32 or 64 bit version (defaults") fmt.Println(" to system arch). Set [arch] to \"all\" to install 32 AND 64 bit versions.") diff --git a/v1.1.8.md b/v1.1.8.md index c29d37f..7105d5d 100644 --- a/v1.1.8.md +++ b/v1.1.8.md @@ -15,7 +15,10 @@ Several long-requested features/fixes have been merged since v1.1.7. I did not g 1. corepack support (see above) 2. Support for spaces in filepaths [#355](https://github.com/coreybutler/nvm-windows/pull/355). 3. `nvm install latest` installs the latest patch version of Node (instead of latest minor). -4. Elevated permissions applied only when necessary [#511](https://github.com/coreybutler/nvm-windows/pull/511) +4. `nvm install lts` installs the latest LTS patch version (new). +5. +6. Elevated permissions applied only when necessary [#511](https://github.com/coreybutler/nvm-windows/pull/511). +7. `nvm current` (new) displays the active version. Several additional minor updates have been applied as well.