diff --git a/pkl-cli/src/test/kotlin/org/pkl/cli/CliCommandRunnerTest.kt b/pkl-cli/src/test/kotlin/org/pkl/cli/CliCommandRunnerTest.kt
index dd1d2aa1..8356c13c 100644
--- a/pkl-cli/src/test/kotlin/org/pkl/cli/CliCommandRunnerTest.kt
+++ b/pkl-cli/src/test/kotlin/org/pkl/cli/CliCommandRunnerTest.kt
@@ -819,14 +819,25 @@ class CliCommandRunnerTest {
val moduleUri =
writePklFile(
"cmd.pkl",
- renderOptions +
- """
+ """
+ extends "pkl:Command"
+
+ options: Options
+
+ output {
+ value = (options) {
+ fromImport {
+ baz = true // assert that imported modules are not forced
+ }
+ }
+ }
+
class Options {
@Argument { convert = (it) -> new Import{ uri = it } }
fromImport: Module
}
"""
- .trimIndent(),
+ .trimIndent(),
)
val importUri =
@@ -835,6 +846,7 @@ class CliCommandRunnerTest {
"""
foo = 1
bar = "baz"
+ baz: Boolean
"""
.trimIndent(),
)
@@ -847,6 +859,7 @@ class CliCommandRunnerTest {
fromImport {
foo = 1
bar = "baz"
+ baz = true
}
"""
@@ -866,7 +879,13 @@ class CliCommandRunnerTest {
options: Options
output {
- value = options
+ value = (options) {
+ fromGlobImport {
+ [[true]] {
+ baz = true // assert that imported modules are not forced
+ }
+ }
+ }
}
class Options {
@@ -883,6 +902,7 @@ class CliCommandRunnerTest {
"""
foo: Int
bar: String
+ baz: Boolean
"""
.trimIndent(),
)
@@ -919,10 +939,12 @@ class CliCommandRunnerTest {
["file:/
/glob1.pkl"] {
foo = 1
bar = "baz"
+ baz = true
}
["file://glob2.pkl"] {
foo = 2
bar = "qux"
+ baz = true
}
}
diff --git a/pkl-commons-cli/src/test/kotlin/org/pkl/commons/cli/CliCommandTest.kt b/pkl-commons-cli/src/test/kotlin/org/pkl/commons/cli/CliCommandTest.kt
index 9fd07c6e..61e9f150 100644
--- a/pkl-commons-cli/src/test/kotlin/org/pkl/commons/cli/CliCommandTest.kt
+++ b/pkl-commons-cli/src/test/kotlin/org/pkl/commons/cli/CliCommandTest.kt
@@ -148,7 +148,7 @@ class CliCommandTest {
amends "pkl:Project"
dependencies {
- ["foo"] = import("$depDir/PklProject")
+ ["foo"] = import("${depDir.toUri().resolve("PklProject")}")
}
"""
.trimIndent()
diff --git a/pkl-core/src/main/java/org/pkl/core/runtime/CommandSpecParser.java b/pkl-core/src/main/java/org/pkl/core/runtime/CommandSpecParser.java
index d149bde3..6e25d529 100644
--- a/pkl-core/src/main/java/org/pkl/core/runtime/CommandSpecParser.java
+++ b/pkl-core/src/main/java/org/pkl/core/runtime/CommandSpecParser.java
@@ -126,7 +126,7 @@ public final class CommandSpecParser {
// instance of CommandSpec.State previously returned from a prior invocation
// of CommandSpec.apply.
parent == null ? null : (SubcommandState) parent.contents()),
- (it) -> evaluateResult(command, (SubcommandState) it)));
+ (it) -> handleErrors(() -> evaluateResult(command, (SubcommandState) it))));
}
private List collectSubcommands(VmTyped commandInfo) {
@@ -488,12 +488,12 @@ public final class CommandSpecParser {
? null
: VmUtils.readMember(annotation, Identifier.CONVERT) instanceof VmFunction func
? (rawValue, workingDirUri) ->
- handleErrors(() -> handleImports(func.apply(rawValue), workingDirUri))
+ handleBadValue(() -> handleImports(func.apply(rawValue), workingDirUri))
: null,
annotation == null
? null
: VmUtils.readMember(annotation, Identifier.TRANSFORM_ALL) instanceof VmFunction func
- ? (it) -> handleErrors(() -> func.apply(VmList.create(it)))
+ ? (it) -> handleBadValue(() -> func.apply(VmList.create(it)))
: null,
annotation == null
? null
@@ -957,7 +957,6 @@ public final class CommandSpecParser {
private SubcommandState buildExecutionModule(
VmTyped module, VmTyped options, @Nullable SubcommandState parent) {
EconomicMap