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

Processing mixed outputs between custom path & output-dir #2051

Closed
RafPe opened this issue Apr 20, 2024 · 1 comment
Closed

Processing mixed outputs between custom path & output-dir #2051

RafPe opened this issue Apr 20, 2024 · 1 comment

Comments

@RafPe
Copy link

RafPe commented Apr 20, 2024

Looking for some inisghts on controlling outputs of templating mix between templated files and dynamic outputs from templates.

For ease of example lets assume I have the following example.t file

Hello  {{ . }} 

I then have the following structure of folders/files for my template to be rendered from. Lets say I run it from /base/template/input

.
├── dynamic.tmpl
├── content_foo.txt
└── content_bar.tf

in the dynamic.tmpl I have the following setup

{{- range $hello_name := .mycontext.some_range_of_inputs }}
{{- $outPath := printf "hello.%s.txt" $hello_name }}
{{- tmpl.Exec "hello" $hello_name | file.Write $outPath }}
{{- end }}

Now the problem I am trying to solve is to be able to template the outputs from /base/template/input into lets say /results/output. Rigjt now however I struggle with the fact of how to pass the --output-dir context into the dynamic templates and how not to include that file in the final results of the templating :) ? So the expected result is

.
├── hello_bar.txt
├── hello_xyz.txt
├── hello_abc.txt
├── content_foo.txt
└── content_bar.tf
@hairyhenderson
Copy link
Owner

Sorry for the delay in answering... Have a look at https://docs.gomplate.ca/usage/#--exclude-and---include - I think that does what you want.

Closing for now as there's no obvious action to be taken - feel free to re-open, or start a discussion if you need more help.

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

2 participants