From 40ae5103ea55d8331604033787c21f378d9ad294 Mon Sep 17 00:00:00 2001 From: Riaz Laskar Date: Mon, 28 Sep 2020 22:46:08 +0530 Subject: [PATCH] add support for nvm current command as the linux nvm has that its missing in windows version --- src/nvm.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/nvm.go b/src/nvm.go index a6699c7..381d135 100644 --- a/src/nvm.go +++ b/src/nvm.go @@ -17,6 +17,7 @@ import ( "./nvm/arch" "./nvm/file" "./nvm/node" + "github.com/blang/semver" "github.com/olekukonko/tablewriter" ) @@ -115,7 +116,16 @@ func main() { env.proxy = detail saveSettings() } - + case "current": + inuse, _ := node.GetCurrentVersion() + v, _ := semver.Make(inuse) + err := v.Validate() + if err == nil { + fmt.Println("v" + inuse) + } else { + fmt.Println(inuse) + } + //case "update": update() case "node_mirror": setNodeMirror(detail) case "npm_mirror": setNpmMirror(detail)