-
I'm using Nickel to implement a suite of python project templates, thinking a bunch of related cookiecutter templates with many shared configs (in This works fine and will output: "Adam's age is 20."
But this will raise an exception saying that
The reason for putting Looking through the repo, I found a similar use case in
Now However, this approach of wrapping every templated string in a function seems to have a few drawbacks:
So what would be the best approach for this use case? Is there any Nickel feature that I missed? Perhaps an alternative pattern to write nickel configurations that's more ergonomic? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
The idiomatic Nickel way to do this is to use an incompletely defined record in
This keeps the ability to override
|
Beta Was this translation helpful? Give feedback.
The idiomatic Nickel way to do this is to use an incompletely defined record in
template.ncl
like so:This keeps the ability to override
name
andage
and the possibility of merging more configuration snippets together. If you need to target a specific export format that doesn't tolerate extra fields, you can annotate them like so: