Hi, thanks for the great library, I use a couple of the templates for loads of my work. I have a general question about cookiecutter that I couldn't find in the docs. Are you able to have conditional variables e.g. if one is specified then you can specify some more options?
Something like:
{"database": [
{"mongodb": {
"dbname": "test"
"collection":"default"
},
"postgresql": {
"server": "localhost",
"port": 5432
}
]
}
Or is logic like this outside the scope of cookiecutter?
Hi @vahndi! 馃憢
Thank you for your feedback. I am very happy to hear that you find cookiecutter useful. 馃槂
Currently cookiecutter does not support conditional variables as you describe them.
We do have plans for adding this and many more features to a new cookiecutter.json format. Unfortunately development and maintenance of this project is not funded, which is why we as a core team decided to put the efforts of implementing a new format on hold, as it would greatly increase the complexity of the code base and therefor require more work from maintainers. We will happily work on this change as soon as we receive sponsorship for it.
Please see #848.
Ok cool thanks for the clarification - just wanted to make sure I wasn't missing anything. The reason for the question is because I am developing a template web app generator similar to CICADA but with a significant amount of customization and I wanted to know where to draw the dividing line between cookiecutter and jinja2. I think I can use cookiecutter for the structural templates and jinja2 for generating other components but it would have been nice to be able to choose and configure different elements for the stack in cookiecutter e.g. different databases.
We are only at the proof of concept stage right now so we aren't going to need the different structural options yet - will take a proper read of 848 and get back to you if we are able to help sponsor something in the future.
Cheers
Awesome!
FYI cookiecutter uses jinja2 under the hood. You can use the same syntax for your templates.
Hi,
Is there any advance on the conditional variables in the cookiecutter.json as described here?
Thanks,
Roberto
See #1438.
Is this issue resolved? I am having similar use-case
Most helpful comment
Hi,
Is there any advance on the conditional variables in the cookiecutter.json as described here?
Thanks,
Roberto