diff --git a/clikt/build.gradle.kts b/clikt/build.gradle.kts index 8c1dbb5b7..0b0fcec3c 100644 --- a/clikt/build.gradle.kts +++ b/clikt/build.gradle.kts @@ -1,6 +1,5 @@ @file:Suppress("UNUSED_VARIABLE", "KotlinRedundantDiagnosticSuppress") - plugins { kotlin("multiplatform") alias(libs.plugins.publish) @@ -38,43 +37,5 @@ kotlin { api(libs.jimfs) } } - - val nativeMain by creating { - dependsOn(commonMain) - } - val linuxX64Main by getting { - dependsOn(nativeMain) - } - val mingwX64Main by getting { - dependsOn(nativeMain) - } - val nativeDarwinMain by creating { - dependsOn(nativeMain) - } - val macosX64Main by getting { - dependsOn(nativeDarwinMain) - } - val macosArm64Main by getting { - dependsOn(nativeDarwinMain) - } - - val nativeTest by creating { - dependsOn(commonTest) - } - val linuxX64Test by getting { - dependsOn(nativeTest) - } - val mingwX64Test by getting { - dependsOn(nativeTest) - } - val nativeDarwinTest by creating { - dependsOn(nativeTest) - } - val macosX64Test by getting { - dependsOn(nativeDarwinTest) - } - val macosArm64Test by getting { - dependsOn(nativeDarwinTest) - } } } diff --git a/clikt/src/commonMain/kotlin/com/github/ajalt/clikt/mpp/MppH.kt b/clikt/src/commonMain/kotlin/com/github/ajalt/clikt/mpp/MppH.kt index 10e9a1ec2..bf8dd0106 100644 --- a/clikt/src/commonMain/kotlin/com/github/ajalt/clikt/mpp/MppH.kt +++ b/clikt/src/commonMain/kotlin/com/github/ajalt/clikt/mpp/MppH.kt @@ -11,6 +11,4 @@ internal expect fun isWindowsMpp(): Boolean /** Doesn't return [Nothing], since it's a no-op on the browser */ internal expect fun exitProcessMpp(status: Int) -internal expect fun isLetterOrDigit(c: Char): Boolean - internal expect fun readFileIfExists(filename: String): String? diff --git a/clikt/src/commonMain/kotlin/com/github/ajalt/clikt/parameters/options/Option.kt b/clikt/src/commonMain/kotlin/com/github/ajalt/clikt/parameters/options/Option.kt index 5b5bb5e86..3eec350b8 100644 --- a/clikt/src/commonMain/kotlin/com/github/ajalt/clikt/parameters/options/Option.kt +++ b/clikt/src/commonMain/kotlin/com/github/ajalt/clikt/parameters/options/Option.kt @@ -1,8 +1,10 @@ package com.github.ajalt.clikt.parameters.options import com.github.ajalt.clikt.completion.CompletionCandidates -import com.github.ajalt.clikt.core.* -import com.github.ajalt.clikt.mpp.isLetterOrDigit +import com.github.ajalt.clikt.core.Context +import com.github.ajalt.clikt.core.GroupableOption +import com.github.ajalt.clikt.core.ParameterHolder +import com.github.ajalt.clikt.core.StaticallyGroupedOption import com.github.ajalt.clikt.output.HelpFormatter import com.github.ajalt.clikt.parsers.Invocation import com.github.ajalt.clikt.sources.ValueSource @@ -130,7 +132,7 @@ internal fun inferEnvvar(names: Set, envvar: String?, autoEnvvarPrefix: /** Split an option token into a pair of prefix to simple name. */ internal fun splitOptionPrefix(name: String): Pair = when { - name.length < 2 || isLetterOrDigit(name[0]) -> "" to name + name.length < 2 || name[0] !in "-@/+" -> "" to name name.length > 2 && name[0] == name[1] -> name.slice(0..1) to name.substring(2) else -> name.substring(0, 1) to name.substring(1) } diff --git a/clikt/src/jsMain/kotlin/com/github/ajalt/clikt/mpp/MppImpl.kt b/clikt/src/jsMain/kotlin/com/github/ajalt/clikt/mpp/MppImpl.kt index 0b473d824..9f77371df 100644 --- a/clikt/src/jsMain/kotlin/com/github/ajalt/clikt/mpp/MppImpl.kt +++ b/clikt/src/jsMain/kotlin/com/github/ajalt/clikt/mpp/MppImpl.kt @@ -35,12 +35,8 @@ private val impls: JsMppImpls = try { BrowserMppImpls } -private val LETTER_OR_DIGIT_RE = Regex("""[a-zA-Z0-9]""") - internal actual val String.graphemeLengthMpp: Int get() = replace(ANSI_CODE_RE, "").length -internal actual fun isLetterOrDigit(c: Char): Boolean = LETTER_OR_DIGIT_RE.matches(c.toString()) - internal actual fun readEnvvar(key: String): String? = impls.readEnvvar(key) internal actual fun isWindowsMpp(): Boolean = impls.isWindowsMpp() internal actual fun exitProcessMpp(status: Int): Unit = impls.exitProcessMpp(status) diff --git a/clikt/src/jvmMain/kotlin/com/github/ajalt/clikt/mpp/MppImpl.kt b/clikt/src/jvmMain/kotlin/com/github/ajalt/clikt/mpp/MppImpl.kt index b8d2c3cbf..442f1f5ea 100644 --- a/clikt/src/jvmMain/kotlin/com/github/ajalt/clikt/mpp/MppImpl.kt +++ b/clikt/src/jvmMain/kotlin/com/github/ajalt/clikt/mpp/MppImpl.kt @@ -18,10 +18,6 @@ internal actual fun exitProcessMpp(status: Int) { exitProcess(status) } -internal actual fun isLetterOrDigit(c: Char): Boolean { - return c.isLetterOrDigit() -} - internal actual fun readFileIfExists(filename: String): String? { val file = File(filename) if (!file.isFile) return null diff --git a/clikt/src/linuxX64Main/kotlin/com/github/ajalt/clikt/mpp/MppImpl.kt b/clikt/src/linuxMain/kotlin/com/github/ajalt/clikt/mpp/MppImpl.kt similarity index 100% rename from clikt/src/linuxX64Main/kotlin/com/github/ajalt/clikt/mpp/MppImpl.kt rename to clikt/src/linuxMain/kotlin/com/github/ajalt/clikt/mpp/MppImpl.kt diff --git a/clikt/src/linuxX64Main/kotlin/com/github/ajalt/clikt/output/EditorMPP.kt b/clikt/src/linuxMain/kotlin/com/github/ajalt/clikt/output/EditorMPP.kt similarity index 100% rename from clikt/src/linuxX64Main/kotlin/com/github/ajalt/clikt/output/EditorMPP.kt rename to clikt/src/linuxMain/kotlin/com/github/ajalt/clikt/output/EditorMPP.kt diff --git a/clikt/src/nativeDarwinMain/kotlin/com/github/ajalt/clikt/mpp/MppImpl.kt b/clikt/src/macosMain/kotlin/com/github/ajalt/clikt/mpp/MppImpl.kt similarity index 100% rename from clikt/src/nativeDarwinMain/kotlin/com/github/ajalt/clikt/mpp/MppImpl.kt rename to clikt/src/macosMain/kotlin/com/github/ajalt/clikt/mpp/MppImpl.kt diff --git a/clikt/src/nativeDarwinMain/kotlin/com/github/ajalt/clikt/output/EditorMPP.kt b/clikt/src/macosMain/kotlin/com/github/ajalt/clikt/output/EditorMPP.kt similarity index 100% rename from clikt/src/nativeDarwinMain/kotlin/com/github/ajalt/clikt/output/EditorMPP.kt rename to clikt/src/macosMain/kotlin/com/github/ajalt/clikt/output/EditorMPP.kt diff --git a/clikt/src/mingwX64Main/kotlin/com/github/ajalt/clikt/mpp/MppImpl.kt b/clikt/src/mingwMain/kotlin/com/github/ajalt/clikt/mpp/MppImpl.kt similarity index 100% rename from clikt/src/mingwX64Main/kotlin/com/github/ajalt/clikt/mpp/MppImpl.kt rename to clikt/src/mingwMain/kotlin/com/github/ajalt/clikt/mpp/MppImpl.kt diff --git a/clikt/src/mingwX64Main/kotlin/com/github/ajalt/clikt/output/EditorMPP.kt b/clikt/src/mingwMain/kotlin/com/github/ajalt/clikt/output/EditorMPP.kt similarity index 100% rename from clikt/src/mingwX64Main/kotlin/com/github/ajalt/clikt/output/EditorMPP.kt rename to clikt/src/mingwMain/kotlin/com/github/ajalt/clikt/output/EditorMPP.kt diff --git a/clikt/src/nativeMain/kotlin/com/github/ajalt/clikt/mpp/MppImpl.kt b/clikt/src/nativeMain/kotlin/com/github/ajalt/clikt/mpp/MppImpl.kt index 07669a766..44de82ef7 100644 --- a/clikt/src/nativeMain/kotlin/com/github/ajalt/clikt/mpp/MppImpl.kt +++ b/clikt/src/nativeMain/kotlin/com/github/ajalt/clikt/mpp/MppImpl.kt @@ -9,12 +9,8 @@ import platform.posix.fopen import kotlin.experimental.ExperimentalNativeApi import kotlin.system.exitProcess -private val LETTER_OR_DIGIT_RE = Regex("""[a-zA-Z0-9]""") - internal actual val String.graphemeLengthMpp: Int get() = replace(ANSI_CODE_RE, "").length -internal actual fun isLetterOrDigit(c: Char): Boolean = LETTER_OR_DIGIT_RE.matches(c.toString()) - internal actual fun isWindowsMpp(): Boolean = Platform.osFamily == OsFamily.WINDOWS internal actual fun exitProcessMpp(status: Int): Unit = exitProcess(status) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 8694255bc..ea763446e 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,5 +1,5 @@ [versions] -kotlin = "1.9.10" +kotlin = "1.9.20" [libraries] mordant = "com.github.ajalt.mordant:mordant:2.2.0" @@ -14,5 +14,5 @@ kodein = "org.kodein.di:kodein-di-generic-jvm:5.2.0" kotlinx-serialization = "org.jetbrains.kotlinx:kotlinx-serialization-json:1.5.1" [plugins] -dokka = "org.jetbrains.dokka:1.9.0" +dokka = "org.jetbrains.dokka:1.9.10" publish = "com.vanniktech.maven.publish:0.25.3"