Clarify usage options print

Update subcommand validation.
This commit is contained in:
erik 2022-09-01 14:00:07 +02:00
parent aeba7f221a
commit ef2e5c6cb7
2 changed files with 3 additions and 3 deletions

View file

@ -18,7 +18,7 @@ fun main(args: Array<String>) {
val checkedArgs = if (args.isEmpty()) arrayOf("-h") else args val checkedArgs = if (args.isEmpty()) arrayOf("-h") else args
// validate subcommand // validate subcommand
if (!ServerType.values().any {it.name.lowercase() == args[0]}) { if (!checkedArgs.contains("-h") && !ServerType.values().any {it.name.lowercase() == checkedArgs[0]}) {
println("Unknown serverType. Currently only k3s is accepted.") println("Unknown serverType. Currently only k3s is accepted.")
exitProcess(1) exitProcess(1)
} }

View file

@ -54,7 +54,7 @@ class CliArgumentsParser(name: String) : CliTargetParser(name) {
var submodules: List<String>? = null var submodules: List<String>? = null
} }
class K3s : ServerSubcommand("k3s", "the k3s module") { class K3s : ServerSubcommand("k3s", "the k3s module, 'provs-server.jar k3s --help' for more info") {
val cliConfigFileName by option( val cliConfigFileName by option(
ArgType.String, ArgType.String,
"config-file", "config-file",
@ -82,7 +82,7 @@ class CliArgumentsParser(name: String) : CliTargetParser(name) {
} }
} }
class K3d : ServerSubcommand("k3d", "the k3s module") { class K3d : ServerSubcommand("k3d", "the k3d module, 'provs-server.jar k3d --help' for more info") {
override fun execute() { override fun execute() {
TODO("Not yet implemented") TODO("Not yet implemented")
} }