Cope better when not enough arguments are inputted
This commit is contained in:
parent
2a8f65c953
commit
59056dbdfc
|
@ -10,7 +10,7 @@ application {
|
||||||
}
|
}
|
||||||
|
|
||||||
group = "xyz.maxwellj.mapm"
|
group = "xyz.maxwellj.mapm"
|
||||||
version = "0.0.2"
|
version = "0.0.3"
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
|
|
@ -54,8 +54,33 @@ fun md5(input:String): String {
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun main(args: Array<String>) {
|
suspend fun main(args: Array<String>) {
|
||||||
|
if (args.size < 2) {
|
||||||
|
if (args.size == 1) {
|
||||||
|
if (args[0] == "h") {
|
||||||
|
println("mapm - Max's Package Manager")
|
||||||
|
println("Version 0.0.3")
|
||||||
|
println("(C) Maxwell Jeffress 2024, licensed under the GNU GPL V3")
|
||||||
|
println("")
|
||||||
|
println("---Help---")
|
||||||
|
println("Arguments that can be run")
|
||||||
|
println("g Grab a package from the internet")
|
||||||
|
println("r Remove a package")
|
||||||
|
println("c Generate a checksum for a package")
|
||||||
|
println("")
|
||||||
|
println("More info at the following links:")
|
||||||
|
println("https://maxwellj.xyz/mapm")
|
||||||
|
println("https://git.maxwellj.xyz/max/mapm")
|
||||||
|
exitProcess(0)
|
||||||
|
} else {
|
||||||
|
println("USAGE: mapm [g, r, c, m] [package name] Type 'h' for help")
|
||||||
|
exitProcess(1)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
println("USAGE: mapm [g, r, c, m] [package name] Type 'h' for help")
|
||||||
|
exitProcess(1)
|
||||||
|
}
|
||||||
|
}
|
||||||
var userInput: String = args[0]
|
var userInput: String = args[0]
|
||||||
println(userInput)
|
|
||||||
if (userInput == "g") {
|
if (userInput == "g") {
|
||||||
val userInput: String = args[1]
|
val userInput: String = args[1]
|
||||||
val linkToUse = "https://git.maxwellj.xyz/mapm/stable/raw/branch/main/$userInput/source"
|
val linkToUse = "https://git.maxwellj.xyz/mapm/stable/raw/branch/main/$userInput/source"
|
||||||
|
@ -99,9 +124,10 @@ suspend fun main(args: Array<String>) {
|
||||||
println("Checksum of that file is ${md5(file.readText())}")
|
println("Checksum of that file is ${md5(file.readText())}")
|
||||||
} else if (userInput == "m") {
|
} else if (userInput == "m") {
|
||||||
println("this feature is in progress")
|
println("this feature is in progress")
|
||||||
} else {
|
println("")
|
||||||
|
} else if (userInput == "h") {
|
||||||
println("mapm - Max's Package Manager")
|
println("mapm - Max's Package Manager")
|
||||||
println("Version 0.0.2")
|
println("Version 0.0.3")
|
||||||
println("(C) Maxwell Jeffress 2024, licensed under the GNU GPL V3")
|
println("(C) Maxwell Jeffress 2024, licensed under the GNU GPL V3")
|
||||||
println("")
|
println("")
|
||||||
println("---Help---")
|
println("---Help---")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user