Replies: 4 comments 24 replies
-
I'm afraid it is not possible to use Jinja in such a way in copier.yml. If the file itself was templated, you could do this: project_type:
type: str
choices: [{% for i in ["one", "two"] %}'{{ i }}',{% endfor %}] ...but that is not the case: only values are templated. Therefore you cannot use Jinja syntax outside of quoted values. I'm not sure whether there's a workaround 😕 |
Beta Was this translation helpful? Give feedback.
-
Why do you want to construct dynamic choices? |
Beta Was this translation helpful? Give feedback.
-
Related to this question is the dynamic construction of a default value (a list of choice values) for a multiple-choice question. |
Beta Was this translation helpful? Give feedback.
-
How about allowing a string value for |
Beta Was this translation helpful? Give feedback.
-
Hi,
I'm trying to construct the choices list via a jinja for loop:
However, this results in a single quoted item in the list:
project_type (Use arrow keys) >> one, two
How can the choice be split into a proper list?
Beta Was this translation helpful? Give feedback.
All reactions