Multi-file output should honor the output format flag
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):
// 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.
Makes sense.
This would be a breaking change, but the breakage would be: -f previously didn't affect output, and now does.
Is this a bug than a feature? If I look into the CliEvaluator I see that it set the expected format:
https://github.com/apple/pkl/blob/main/pkl-cli%2Fsrc%2Fmain%2Fkotlin%2Forg%2Fpkl%2Fcli%2FCliEvaluator.kt#L199-L203
But it seems it will not be respected 🤔