Prompts
Closed this issue · 1 comments
chevcast commented
Command author needs a helper for creating prompts. The desired usage would be:
res.prompt('name', function (value) {
// do work with value
});
The name is important because when prompt is encountered it should examine the provided options to see if a value exists for that name already. If not, then it should prompt for it. This would allow end-users to do either of the following with a hypothetical 'login' command:
login
prompt for username
prompt for password
or
login username
prompt for password
or
login username password
So the logic for the res.prompt()
function would be something like this:
if ('promptVar' in options) callback(options[promptVar]);
else setContext(); // Set a context so next provided user input would route back here and invoke the callback.
When a prompt is finished it should restore the previous context (either none or passive).
chevcast commented
Prompts have been implemented.