You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have following optional group idea is to make it required at all times and use coocurring group as those options are needed for almost all commands:
classExplicitCredentials: OptionGroup() {
val panelUrl:String by option("--url", "-u")
.required()
.help("Pterodactyl Instance")
val apiKey:String by option("--api-key", "-a")
.required()
.help("API key for an Instance")
}
The usage of said group is as follows
classPowerActionCommand : CliktCommand(name = "power") {
val credentials by ExplicitCredentials().cooccurring()
val servers by ServerIds().cooccurring()
val action:PowerAction by argument().enum()
overridefunrun() {
credentials?.let { creds ->val api =PteroBuilder.createClient(creds.panelUrl, creds.apiKey)
servers?.let {
for (server in it.serverIds) {
api.retrieveServerByIdentifier(server)
.flatMap { clientServer -> clientServer.setPower(action) }
.execute()
}
}
} ?: echo("No credentials specified")
}
}
Is it possible to mark group as not nullable in this case?
The text was updated successfully, but these errors were encountered:
I might be misunderstanding the request, but if you want all the options in the group to be required all the time, you don't need coocurring. Just do val group by MyGroup().
I have following optional group idea is to make it required at all times and use coocurring group as those options are needed for almost all commands:
The usage of said group is as follows
Is it possible to mark group as not nullable in this case?
The text was updated successfully, but these errors were encountered: