sgmonda/stdio

Allow for specification of all question options, preserving backward compatibility

Opened this issue · 0 comments

In addition to taking an array as the third argument to stdio.question for the valid responses (for backward compatibility), accept an object with the following keys/ For example:

{
  echo: true, // default: true
  regex: /[aAbBcC]+/, // default: /.*/
  values: ['male', 'female'] // default: null/undefined/[]
}

Really, though, values could be shorthand for regex (/male|female/ in the example above).

I thought of this as a more general mechanism while entering #15, which this issue could supercede.