apple / apple/pkl

Multi-file output should honor the output format flag

Open
#415 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
11.5k
Forks
402
Avg merge
1d 15h
Merged PRs (30d)
20

Description

Currently, evaluation of a Pkl module with multi-file output ignores the output format parameter for the `pkl eval` call (or the `outputFormat` property in case of the Gradle plugin). For example (snippet taken from the [docs](https://pkl-lang.org/main/current/language-reference/index.html#multiple-file-output)):
```pkl
// birds.pkl

pigeon {
name = "Pigeon"
diet = "Seeds"
}
parrot {
name = "Parrot"
diet = "Seeds"
}
output {
files {
["birds/pigeon.out"] {
value = pigeon
}
["birds/parrot.out"] {
value = parrot
}
}
}
```

```
> pkl eval -m output/ -f yaml birds.pkl
output/birds/pigeon.out
output/birds/parrot.out
> cat output/birds/parrot.out
name = "Parrot"
diet = "Seeds"
> cat output/birds/pigeon.out
name = "Pigeon"
diet = "Seeds"
```

This is different from the regular single-file output mode, where `-f` would determine the default renderer in case it is not explicitly specified.

It would probably make sense for the `-f` argument to be honored for multi-file output as well, in the same way as for single-file output - by determining the output format in case an explicit renderer is not defined.

Contributor guide

Open the contributing guide

Research direction

Start with the pkl eval multi-file output path and the Gradle plugin's outputFormat handling; compare them with single-file -f behavior described in the issue and linked language-reference example. Done when -f yaml, and the plugin property, select the default renderer for each generated file unless an explicit renderer is set.

Written by the indexing model from the issue text.

Assessment

Tech stack
yaml
Domain
build-system, cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.