Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi-file output should honor the output format flag #415

Open
netvl opened this issue Apr 10, 2024 · 2 comments
Open

Multi-file output should honor the output format flag #415

netvl opened this issue Apr 10, 2024 · 2 comments

Comments

@netvl
Copy link

netvl commented Apr 10, 2024

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.

@bioball
Copy link
Contributor

bioball commented Apr 10, 2024

Makes sense.

This would be a breaking change, but the breakage would be: -f previously didn't affect output, and now does.

@StefMa
Copy link
Contributor

StefMa commented Apr 11, 2024

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 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants