Cookiecutter.json has a parameter which accepts "yes" or "no":
{ "test" : [ "yes", "no"] }
If a user selects "yes" then it should continue accepting the inputs further, if not it should stop. The same logic is included in pre_gen_project.py under the hooks folder.
try:
if "{{ cookiecutter.test }}" == "yes":
cookiecutter.prompt.read_user_variable("full_name","your_synthetic_test_name")
else:
sys.exit(0)
except Exception as ex:
print("Exception in pre_gen_project script")
Problem here is, it is entering the else condition, but the cookie cutter execution is not stopping here. Any suggestion, Let me know about it. Thank you.
I think the check that you're doing is wrong. Ideally you should check whether the values that the user parses includes in the allowed set of values you've mentioned in the json
First you need to read the json file:
then check whether the value the user selects exist in the set of values in the json