-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Closed
Labels
Description
I would like to be able to pass a list to the templates. See the two code blocks at the end of this post for an example. Right now it appears that if you pass a list in the config object, it's read as a list of options for that key.
I know that you can use str.split() in the jinja2 template, but that's not a real solution, since it's impossible to "escape" the character that's used as the delimiter. What's the best solution here? I would prefer to be able to pass a list in the json object and call it a day, but obviously that doesn't work for the user input prompts.
cookiecutter.json:
{
"build_steps": [
"do_something",
"do_something_else"
]
}Dockerfile:
FROM something
{% for step in cookiecutter.build_steps %}
RUN {{ step }}
{% endfor %}Reactions are currently unavailable