提交 0265573b 编写于 作者: R rahulroy9202

now checks if input version is greater than latest

上级 e6c5932c
......@@ -119,6 +119,19 @@ func update() {
// }
}
fun checkVersionExceedsLatest(version) bool{
content := web.GetRemoteTextFile("http://nodejs.org/dist/latest/SHASUMS.txt")
re := regexp.MustCompile("node-v(.+)+msi")
reg := regexp.MustCompile("node-v|-x.+")
latest = reg.ReplaceAllString(re.FindString(content),"")
if version < latest {
return false
} else {
return true
}
}
func install(version string, cpuarch string) {
if version == "" {
fmt.Println("\nInvalid version.")
......@@ -141,7 +154,12 @@ func install(version string, cpuarch string) {
if cpuarch != "all" {
cpuarch = arch.Validate(cpuarch)
}
if(checkVersionExceedsLatest(version)) {
fmt.Println("Node.js v"+version+" is not yet available.")
return
}
if cpuarch == "64" && !web.IsNode64bitAvailable(version) {
fmt.Println("Node.js v"+version+" is only available in 32-bit.")
return
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册