copier
copier copied to clipboard
templates / variables in `choices`
Describe the problem
I'm new to both copier and jinja so perhaps I just need to be pointed in the correct direction
I'm trying to construct the choices option on a question
Template
question_choices:
default: ["A","B"]
when: false
actual_question:
help: "the cake is a lie"
choices: ["{{question_choices}}"]
question_choices:
default: ["A","B"]
when: false
actual_question:
help: "the cake is a lie"
choices: "{% for item in {{question_choices}} -%} - 'name': '{{item}}'{% endfor %}"
To Reproduce
No response
Logs
No response
Expected behavior
hoping to be able to generate the valid choices at run time, perhaps via script
Screenshots/screencasts/logs
No response
Operating system
macOS
Operating system distribution and version
Ventura 13.6
Copier version
copier 8.3.0
Python version
Python 3.11.5
Installation method
pip+git
Additional context
No response
I'm afraid what you'd like to do is currently not possible. See also #1193 for a previous discussion.