Umstellung auf Kotlin Multiplatform

This commit is contained in:
Hartmut Bauer committed 2026-01-18 17:17:53 +01:00
1 parent 1ee8dd356f
commit 4a73301eb3
35 files changed
+246 -47

No files matched your search

@@ -1,13 +1,14 @@
package net.keinekekse.args
import net.keinekekse.version.Version
import kotlin.system.exitProcess
expect fun exitApplication(rc: Int = 0): Nothing
class VerifyParameterException(message: String) : RuntimeException(message)
fun showParsingError(msg: String): Nothing {
println(ArgumentParserException.PARSING_ERROR_MSG.format(msg))
exitProcess(2)
println(ArgumentParserException.PARSING_ERROR_MSG + msg + "\n")
exitApplication(2)
}
/**
@@ -311,10 +312,10 @@ class CommandLine(
}
e?.message?.let {
println()
println(ArgumentParserException.PARSING_ERROR_MSG.format(it))
println(ArgumentParserException.PARSING_ERROR_MSG + it + "\n")
println()
}
exitProcess(0)
exitApplication(0)
}
private fun showSubcommands(parameters: MutableMap<String, SubCommandData>) {
@@ -346,7 +347,7 @@ class CommandLine(
private fun showVersion(): Nothing {
println("${programVersion.displayName} ${programVersion.fullVersion}, ${programVersion.copyright}\n")
exitProcess(0)
exitApplication(0)
}
}
@@ -1,7 +1,6 @@
package net.keinekekse.args
import kotlin.reflect.KProperty
import kotlin.system.exitProcess
interface ValueDelegate<T> {
var value: T?
@@ -152,8 +151,8 @@ interface AddParameter {
// Fehler beim Check der Parameter-Definitionen und beim Parsen der Kommandozeile
internal class ArgumentParserException(message: String?) : RuntimeException(message) {
companion object {
const val PARSING_ERROR_MSG = "\n*** ERROR parsing arguments: %s\n"
const val DEFINITION_ERROR_MSG = "\n*** ERROR defining arguments: %s\n"
const val PARSING_ERROR_MSG = "\n*** ERROR parsing arguments: "
const val DEFINITION_ERROR_MSG = "\n*** ERROR defining arguments: "
fun showHelp() = ArgumentParserException(null)
fun noHelpOrVersion() =
ArgumentParserException("Option 'help' and option 'version' are not allowed.")
@@ -226,6 +225,6 @@ internal fun matchArgument(arg: String): Pair<String, String>? =
ARGUMENT_PATTERN.matchEntire(arg)?.groupValues?.let { Pair(it[1] + it[2], it[3]) }
internal fun showDefiningError(msg: String): Nothing {
println(ArgumentParserException.DEFINITION_ERROR_MSG.format(msg))
exitProcess(1)
println(ArgumentParserException.DEFINITION_ERROR_MSG + msg + "\n")
exitApplication(1)
}
@@ -3,14 +3,14 @@ package net.keinekekse.util
import net.keinekekse.version.Version
object VERSION: Version {
override val version = "0.2.8"
override val fullVersion = "0.2.8+build.106"
override val version = "0.3.0-beta.1+build.109"
override val fullVersion = "0.3.0-beta.1+build.109"
override val major = 0
override val minor = 2
override val patch = 8
override val preRelease = ""
override val buildMetadata = "build.106"
override val buildDate = "2026-01-18T01:02:24.139170Z"
override val minor = 3
override val patch = 0
override val preRelease = "beta.1"
override val buildMetadata = "build.109"
override val buildDate = "2026-01-18T16:08:09.445707Z"
override val displayName = "Utility Library"
override val copyright = "Copyright (c) 2025-2026 Hartmut Bauer"
override val name = "util"
@@ -0,0 +1,7 @@
package net.keinekekse.args
import kotlin.system.exitProcess
actual fun exitApplication(rc: Int): Nothing {
exitProcess(rc)
}
@@ -0,0 +1,8 @@
package net.keinekekse.args
import platform.posix.exit
actual fun exitApplication(rc: Int): Nothing {
exit(rc)
return Unit as Nothing
}
@@ -0,0 +1,8 @@
package net.keinekekse.args
import platform.posix.exit
actual fun exitApplication(rc: Int): Nothing {
exit(rc)
return Unit as Nothing
}
@@ -0,0 +1,5 @@
package net.keinekekse.args
actual fun exitApplication(rc: Int): Nothing {
TODO("Not implemented on this platform")
}
@@ -0,0 +1,5 @@
package net.keinekekse.args
actual fun exitApplication(rc: Int): Nothing {
TODO("Not yet implemented") // js + wasmJs
}