Replies: 3 comments 5 replies
-
In your case, though, since your resource already is a Pkl module, you should instead just import* "**.pkl" as allModules
theModuleIWant = allModules[read("prop:input")] A glob import gives you a mapping whose keys are the expanded glob pattern, and values are the matched module itself (see the language reference) to learn more). This gives you the effect you're looking for, where Note: relative glob patterns are expanded relative to the module that the glob is declared in, not your CWD. Note 2: thanks to Pkl's laziness, |
Beta Was this translation helpful? Give feedback.
-
@bioball thanks for the suggestion. I am not sure how would glob approach work with input files not in the source tree? I'd like the following to work:
As well as supporting something along the line: Your suggestion gives me an idea to generate temporary root Maybe |
Beta Was this translation helpful? Give feedback.
-
BTW I have tried generating temporary
but this creates another problem when I try to cast values in my
Because my generate.pkl tool uses |
Beta Was this translation helpful? Give feedback.
-
[Forgive me if this is something basic, but I can't find an answer in documentation]
I am trying to write pkl document transform. It want it to be used like
pkl eval -p input=my_input.pkl transform.pkl
where I always expectmy_input.pkl
to amend a certainMyRootModule
module.How do I
read()
a typed value from the input then? I have usedread(input)
to receive aResource
object with untypedtext
, but how do I get the instance ofMyRootModule
instead?Beta Was this translation helpful? Give feedback.
All reactions