-
Notifications
You must be signed in to change notification settings - Fork 280
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
pkl eval ignores --format
option on use of -x, --expression
#774
Comments
This a dupe of #742 |
Ahh, ok. So what I have to understand is that the default for I guess the part about Perhaps it's possible to improve the docs for the I think Pkl stands out here as, with Pkl, rendering happens inside the language behind this hidden output property. Anyone coming to Pkl from another configuration language might expect that the language stops once the contents of the module file have been computed and then the tool is rendering to the supported formats. Rereading the introduction's concepts, the paragraph on evaluation seems to misrepresent Pkl in this regard:
To me it implies that Pkl works like how I understand Dhall, CUE and KCL to work. (Which I now believe not to be the case). Sorry for this wall of text. I really just wanted to try to explore where my misconceptions came from and see if I could help find a way to avoid someone else falling into this trap. Also, in case it's helpful, the use case that I had was: given a large amount of configuration in a single module, can Pkl select and output only part of it. That's what I was after when I spotted the |
Is there a reason why |
Modules can set |
Right, but I think this problem already exists for The following would at least be consistent and easy to explain:
|
I think that sentence is a little misleading, but it's actually correct in the strict sense. The conversion can be: Pkl string -> string bytes (in the case of the CLI), or can also be: Pkl object to class/struct/primitive in a host language (in the case of using Pkl as a library). To your point, the discrepancy between Pkl and Cue/KCL/Dhall is that rendering happens in-language, and you can affect how rendering happens when you author Pkl code.
One of the use-cases for the If it was defined as
Instead of:
But, I'm more and more thinking that we should provide some way to improve the interaction between |
When using eval's
-x
option, the--format
option appears to be ignored.Evaluating the following
gives
I had expected it to give
Checked with
Pkl 0.26.3 (macOS 14.4.1, native)
and a build from main,Pkl 0.27.0-dev+9692504 (macOS 14.6.1, native)
.If only always wanting a fixed format, a workaround for now is to configure both wishes in the output property.
Details
The text was updated successfully, but these errors were encountered: