We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6c68da8 commit 514c956Copy full SHA for 514c956
src/main/kotlin/kscript/app/Kscript.kt
@@ -185,6 +185,8 @@ fun main(args: Array<String>) {
185
val className = scriptFile.nameWithoutExtension
186
.replace("[^A-Za-z0-9]".toRegex(), "_")
187
.capitalize()
188
+ // also make sure that it is a valid identifier by avoiding an initial digit (to stay in sync with what the kotlin script compiler will do as well)
189
+ .let { if ("^[0-9]".toRegex().containsMatchIn(it)) "_" + it else it }
190
191
192
// Define the entrypoint for the scriptlet jar
0 commit comments