Settings

Theme

Show HN: tgen: A template tool a la Helm or Consul Templates

github.com

6 points by pdappollonio 4 years ago · 3 comments

Reader

verdverm 4 years ago

Very cool, I have a project that does similar, uses CUE as input.

What do you use it for your self? I've been using mine to generate scaffolding or boilerplate

Can you output multiple files with one run?

  • pdappollonioOP 4 years ago

    Hey! Appreciate it!

    It's used in production in the past 3 companies I've worked for (a movie company, a gaming company, and a computer hardware company). In all cases it's used to templetize resources in a CI pipeline -- although others have told me they use it as a very, very slim Helm replacement.

    In my current case, I'm working with a Google product that requires a Rego policy to be embedded into a YAML for Kubernetes, so this allows embedding it (see in the Readme the last example).

    Currently, it cannot output multiple files in one run. How would you envision that? Would you say you would prefer passing a folder and any file inside of it is templetized or rather you would see multiple "-f" flags? Let me know, happy to work on it, since it's also a need I've been told from other parties too!

    • verdverm 4 years ago

      I've been using https://cuelang.org for any configuration / yaml like generation. This link has a GH search with two discussions that talk about Rego: https://github.com/cue-lang/cue/search?q=rego&type=discussio...

      I wrote https://github.com/hofstadter-io/hof to use this concept "at scale", i.e. inputting & outputting multiple files & dirs. The main idea was to generate common code across the stack from a single-source-of-truth. Today it inputs CUE only, which has all the things needed to validate the incoming data and also contains the templates, so `hof gen` takes the same args as `cue export`. It uses diff3 so that you can regenerate the output after modifying the input or the generated content, which is something I needed so that when I fill in the generated API handler func, and then change the design a bit, that I can keep the manual work.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection