Replies: 1 comment 1 reply
-
It seems to me like you have 2 templates. The 1st one sets up the project
root. The 2nd one is for a cluster.
The 1st one could use tasks to copy the 2nd one in loop.
Would that work for you?
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi. Is there a way to generate multiple templates based off an answer to a question in copier?
For example if i had a question like this:
prd_clusters: type: str help: "enter comma seperated list of prd clusters. eg: prd-1,prd-2,prd-3" default: prd-1,prd-2
i would like to be able to split the str into a list and produce a templated file per item in the list.
I would also like to be able to access the name of that item from within the template. for example the template file needs to contain something like:
name: {{ release_name }}-{{ p }}
where {{ p }} is the current item when iterating through the prd_clusters var from the question, from something like:
{% for p in prd_clusters.split(',') %}.
Is this something i could achieve using copier? I have read the docs on Conditional Files and Directories but if i embed the for loop in a file name i lose the context within the template. i.e i cant use {{ p }} in the template
Beta Was this translation helpful? Give feedback.
All reactions