Skip to content

Commit

Permalink
Fix the dry-run directive
Browse files Browse the repository at this point in the history
  • Loading branch information
ctrueden committed May 1, 2024
1 parent 5295900 commit 40759a0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/commonMain/kotlin/jvm.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class JvmRuntimeConfig(recognizedArgs: Array<String>) :
var java: JavaInstallation? = null

override val supportedDirectives: DirectivesMap = mutableMapOf(
"dry-run" to { printlnErr(dryRun()) },
"dry-run" to { args -> printlnErr(dryRun(args)) },
"print-class-path" to { printlnErr(classpath() ?: "<none>") },
"print-java-home" to { printlnErr(javaHome()) },
"print-java-info" to { printlnErr(javaInfo()) },
Expand Down Expand Up @@ -159,12 +159,12 @@ class JvmRuntimeConfig(recognizedArgs: Array<String>) :
return classpathArg.substring(prefix.length).replace(COLON, divider)
}

fun dryRun(): String {
fun dryRun(args: ProgramArgs): String {
return buildString {
append(java?.binJava ?: "java")
runtimeArgs.forEach { append(" $it") }
args.runtime.forEach { append(" $it") }
append(" $mainProgram")
mainArgs.forEach { append(" $it") }
args.main.forEach { append(" $it") }
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/commonMain/kotlin/python.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class PythonRuntimeConfig(recognizedArgs: Array<String>) :
var python: PythonInstallation? = null

override val supportedDirectives: DirectivesMap = mutableMapOf(
"dry-run" to { printlnErr(dryRun()) },
"dry-run" to { args -> printlnErr(dryRun(args)) },
"print-python-home" to { printlnErr(pythonHome()) },
"print-python-info" to { printlnErr(pythonInfo()) },
)
Expand Down Expand Up @@ -110,12 +110,12 @@ class PythonRuntimeConfig(recognizedArgs: Array<String>) :

// -- Directive handlers --

fun dryRun(): String {
fun dryRun(args: ProgramArgs): String {
return buildString {
append(python?.binPython ?: "python")
runtimeArgs.forEach { append(" $it") }
args.runtime.forEach { append(" $it") }
append(" $mainProgram")
mainArgs.forEach { append(" $it") }
args.main.forEach { append(" $it") }
}
}

Expand Down

0 comments on commit 40759a0

Please sign in to comment.