copier icon indicating copy to clipboard operation
copier copied to clipboard

Nested prompts

Open dellekappa opened this issue 7 months ago • 2 comments

This PR relates to issue #751

Some reasoning follows:

  • implemented the question type dict that will be rendered, as expected, as a dict in jinja context. This is why I used dict instead of nested
  • 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.property synthax 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

dellekappa avatar Jul 08 '25 10:07 dellekappa

Thanks for creating this PR to implement nested prompts, @dellekappa! :bow: I'll give feedback ASAP.

sisp avatar Jul 09 '25 14:07 sisp

@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.

dellekappa avatar Jul 10 '25 15:07 dellekappa