Cope better when not enough arguments are inputted

This commit is contained in:
Maxwell Jeffress 2024-09-20 13:23:50 +10:00
parent 2a8f65c953
commit 59056dbdfc
2 changed files with 30 additions and 4 deletions

View File

@ -10,7 +10,7 @@ application {
}
group = "xyz.maxwellj.mapm"
version = "0.0.2"
version = "0.0.3"
repositories {
mavenCentral()

View File

@ -54,8 +54,33 @@ fun md5(input:String): 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]
println(userInput)
if (userInput == "g") {
val userInput: String = args[1]
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())}")
} else if (userInput == "m") {
println("this feature is in progress")
} else {
println("")
} else if (userInput == "h") {
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("")
println("---Help---")