CITGuru / PyInquirer

A Python module for common interactive command line user interfaces
MIT License
1.92k stars 236 forks source link

Update message based on current choices in checkbox #39

Open atrifex opened 5 years ago

atrifex commented 5 years ago

In the Pizza example, it makes sense to update the message with something like the cost.

The questions array basically needs message_update function similar to the validate function and this will just update the message based on that.

AndrewOwenMartin commented 5 years ago

The documentation says that the "message" attribute of a question can be a string or a function that takes the current answers and returns a string. I guess you could use this to solve your issue, however, that doesn't appear to be accurate documentation as any function, or lambda, I use as a questions "message" gets evaluated as a string in the prompt.

AndrewOwenMartin commented 5 years ago

The documentation says that the "message" attribute of a question can be a string or a function that takes the current answers and returns a string. I guess you could use this to solve your issue, however, that doesn't appear to be accurate documentation as any function, or lambda, I use as a questions "message" gets evaluated as a string in the prompt.

I see now that I was taking about something else, I was talking about changing the message due to previous answers, this issue is about updating the message for checkboxes as the selection changes.