mirror of
https://github.com/coreybutler/nvm-windows.git
synced 2026-01-21 03:01:11 +08:00
Merge branch 'master' into master
This commit is contained in:
21
src/nvm.go
21
src/nvm.go
@@ -115,6 +115,7 @@ func main() {
|
||||
env.proxy = detail
|
||||
saveSettings()
|
||||
}
|
||||
|
||||
//case "update": update()
|
||||
case "node_mirror": setNodeMirror(detail)
|
||||
case "npm_mirror": setNpmMirror(detail)
|
||||
@@ -399,7 +400,7 @@ func use(version string, cpuarch string) {
|
||||
if !runElevated(fmt.Sprintf(`"%s" cmd /C rmdir "%s"`,
|
||||
filepath.Join(env.root, "elevate.cmd"),
|
||||
filepath.Clean(env.symlink))) {
|
||||
return
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
@@ -408,7 +409,7 @@ func use(version string, cpuarch string) {
|
||||
filepath.Join(env.root, "elevate.cmd"),
|
||||
filepath.Clean(env.symlink),
|
||||
filepath.Join(env.root, "v"+version))) {
|
||||
return
|
||||
return
|
||||
}
|
||||
|
||||
// Use the assigned CPU architecture
|
||||
@@ -434,6 +435,20 @@ func use(version string, cpuarch string) {
|
||||
fmt.Println("Now using node v"+version+" ("+cpuarch+"-bit)")
|
||||
}
|
||||
|
||||
func useArchitecture(a string) {
|
||||
if strings.ContainsAny("32",os.Getenv("PROCESSOR_ARCHITECTURE")) {
|
||||
fmt.Println("This computer only supports 32-bit processing.")
|
||||
return
|
||||
}
|
||||
if a == "32" || a == "64" {
|
||||
env.arch = a
|
||||
saveSettings()
|
||||
fmt.Println("Set to "+a+"-bit mode")
|
||||
} else {
|
||||
fmt.Println("Cannot set architecture to "+a+". Must be 32 or 64 are acceptable values.")
|
||||
}
|
||||
}
|
||||
|
||||
func list(listtype string) {
|
||||
if listtype == "" {
|
||||
listtype = "installed"
|
||||
@@ -548,7 +563,7 @@ func disable() {
|
||||
if !runElevated(fmt.Sprintf(`"%s" cmd /C rmdir "%s"`,
|
||||
filepath.Join(env.root, "elevate.cmd"),
|
||||
filepath.Clean(env.symlink))) {
|
||||
return
|
||||
return
|
||||
}
|
||||
|
||||
fmt.Println("nvm disabled")
|
||||
|
||||
Reference in New Issue
Block a user