-
Notifications
You must be signed in to change notification settings - Fork 219
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dynamic console-ui prompt improvements, see #1051 #1132
Conversation
This adds an easier way to create complex dynamic prompts
c46b053
to
34650d9
Compare
@mattirn and @gnodet , this might be a bit forward, but I was wondering if we could improve the In the new code the old But this Map needs to be in a very specific state for this to work, it must either be empty or it must contain a value for all previously answered questions. On top of that, if the Map contains values, the In this PR I've introduced a new Just to be clear, this method is not for simple situations, just to make complex situations like the example in
Still, I wouldn't want users to have to use that for simple cases, so for ease-of-use it might be desirable to add methods like the ones that were just deprecated to be able to simply pass a List of prompts. Unfortunately I wasn't able to come up with a solution where the old deprecated methods could be used in both situations (thereby un-deprecating them), so perhaps new methods could be added with a different name? I would also suggest to make the new methods that take a resultMap parameter |
Looks good! There is at least one thing what you cannot do with the new method. The methods that take a resultMap parameter you can modify the header list. For example you can add sub-header before starting a new prompt list. |
Sure, we can do that. But is there a good use-case for that situation? I can understand requiring the user to at least give some answer, but once you get into multiple branching pathways I would imagine it's good to always be able to go back and redo your selections?
True, but having the possibility to go back and forth in the list (really a tree) of questions would make managing headers rather hard anyways, I guess. 🤔 Perhaps it would be an idea to introduce a "text-only element"? That way the printing of headers would be handled by the system itself. A text-only element could be seen as a prompt that immediately returns a dummy/empty answer. (And when cancelling prompts they would be automatically be removed as well). |
Ok, please open an other ticket if you think you can do a pull request to resolve it. |
Done #1136 I'll create a PR for it based on the code in this PR (I assume it will be merged before or at the same time) |
Awesome, thanks! |
This adds an easier way to create complex dynamic prompts