6

I'm wondering, if it's possible to skip prompt for chosen parameters in cookiecutter.json based on value of other parameter? For example for cookiecutter.json:

{
  "ask_for_more": ["y", "n"],
  "some_parameter": "test"
}

I'd like to skip prompt for some_parameter if the answer to ask_for_more was n.

Is it possible ?

pgrzesik
  • 1,869
  • 13
  • 14

1 Answers1

0

At the time of this writing, it is not possible to do it directly via the cookiecutter.json
I think even with pre-gen hook it might not be possible as the cookiecutter jinja templating executes regardless of the if/else python conditions.

There are however lots of PR's and discussions to add this feature. See these links:

Closed threads:
https://github.com/cookiecutter/cookiecutter/issues/881 https://github.com/cookiecutter/cookiecutter/issues/913

Open threads:
https://github.com/cookiecutter/cookiecutter/pull/1645 https://github.com/cookiecutter/cookiecutter/issues/1438

theQuestionMan
  • 1,270
  • 2
  • 18
  • 29