copier
copier copied to clipboard
Nested prompts
This PR relates to issue #751
Some reasoning follows:
- implemented the question type
dictthat will be rendered, as expected, as adictin jinja context. This is why I useddictinstead ofnested - on the answers file side, the answers are still a flat list that includes only the leafs of the question tree, but, to be able to traverse the question tree hierarchy, a classical
property.propertysynthax has been used. Under the hood this is handled by dpath. This permits the user to easily specify an answer value from the command line at any hierarchy level. - the deepness in prompt have been rendered just with indentation. Even if what have been proposed in #751 is much more appealing, is also much harder to implement because requires to know in advance the questions that will be rendered
Thanks for creating this PR to implement nested prompts, @dellekappa! :bow: I'll give feedback ASAP.
@sisp I made a new PR. It is internally a completely different implementation, much easier to mantain and more in line with this sentence in the #751 issue:
a nested question class could act as a container type that delegates asking/prompting to its children
implementing #750 on top of this would be much easier.