Fix regression in CLI error handling when project loading fails (#1439)

This commit is contained in:
Jen Basch
2026-02-25 01:28:05 -08:00
committed by GitHub
parent 28b09134d7
commit 2e4d73b957
2 changed files with 3 additions and 2 deletions

View File

@@ -196,7 +196,7 @@ image::syntax-highlight-error.png[syntax highlighted output]
[[cli-dependency-notation]]
=== CLI Support for Dependency Notation
The Pkl CLI now supports specifying modules using xref:language-reference:index.adoc#project-dependencies[dependency notation] (pr:https://github.com/apple/pkl/pull/1434[]).
The Pkl CLI now supports specifying modules using xref:language-reference:index.adoc#project-dependencies[dependency notation] (pr:https://github.com/apple/pkl/pull/1434[], pr:https://github.com/apple/pkl/pull/1439[]).
This is especially helpful for <<cli-framework,CLI commands>> defined in Packages:
[source,bash]

View File

@@ -111,9 +111,10 @@ abstract class CliCommand(protected val cliOptions: CliBaseOptions) {
remoteDep.packageUri.toPackageAssetUri(path).uri
}
protected val resolvedSourceModules: List<URI> =
protected val resolvedSourceModules: List<URI> by lazy {
if (project == null) cliOptions.normalizedSourceModules
else cliOptions.normalizedSourceModules.map(::resolveModuleUri)
}
protected fun loadProject(projectFile: Path): Project {
val securityManager =