Maybe I'm missing something, but I was not able to pass an set of pre answers to the prompt() function, to override the default values of the questions.
My use case is double:
I'd like to implement a way to load predefined defaults from a file, before prompting the user
An application I wrote (tinject) has a cascade of prompts, where any question may be repeated: at the second prompt() I'd like to be presented the answer given in the first, if any
At first I tried to use the answers argument to the prompt() function, but it didn't have any effect, and checking the source seems to confirm that.
In lelit@8480308fb09990f5dfe7f2214edf12923e6dd900 I modified the default property of the Question class to return the answered value, if present. Does that sound reasonable, or is there a better way to accomplish my goal?
Maybe I'm missing something, but I was not able to pass an set of pre answers to the
prompt()
function, to override the default values of the questions.My use case is double:
prompt()
I'd like to be presented the answer given in the first, if anyAt first I tried to use the
answers
argument to theprompt()
function, but it didn't have any effect, and checking the source seems to confirm that.In lelit@8480308fb09990f5dfe7f2214edf12923e6dd900 I modified the
default
property of theQuestion
class to return the answered value, if present. Does that sound reasonable, or is there a better way to accomplish my goal?