lib/helpers/question_asker.js
function selectMultipleChoices(args) {
  args.choices = args.choices || prepareChoices(args.classes);
  let result = null;
  const merged = merge(DEFAULTS.MULTIPLE_CHOICES, args);
  inquirer.prompt([
    {
      type: DEFAULTS.QUESTION_TYPES.CHECKBOX,
      name: 'answer',
      message: merged.question,
      choices: merged.choices,
      filter: merged.filterFunction
    }
  ]).then((answers) => {
    if (answers.answer.length === 0) {
      result = DEFAULTS.NOTHING;
    } else {
      result = answers.answer;
    }
  });
  while (!result) {
    wait(100);
  }
  return result;
}
function selectMultipleChoices(args) {
  args.choices = args.choices || prepareChoices(args.classes);
  let result = null;
  const merged = merge(DEFAULTS.MULTIPLE_CHOICES, args);
  inquirer.prompt([
    {
      type: DEFAULTS.QUESTION_TYPES.CHECKBOX,
      name: 'answer',
      message: merged.question,
      choices: merged.choices,
      filter: merged.filterFunction
    }
  ]).then((answers) => {
    if (answers.answer.length === 0) {
      result = DEFAULTS.NOTHING;
    } else {
      result = answers.answer;
    }
  });
  while (!result) {
    wait(100);
  }
  return result;
}
function selectMultipleChoices ( args ) { args . choices = args . choices || prepareChoices ( args . classes ) ; let result = null ; const merged = merge ( DEFAULTS . MULTIPLE_CHOICES , args ) ; inquirer . prompt ( [ { type : DEFAULTS . QUESTION_TYPES . CHECKBOX , name : 'answer' , message : merged . question , choices : merged . choices , filter : merged . filterFunction } ] ) . then ( ( answers ) => { if ( answers . answer . length === 0 ) { result = DEFAULTS . NOTHING ; } else { result = answers . answer ; } } ) ; while ( ! result ) { wait ( 100 ) ; } return result ; }
Asks the user for one, or more choices.
@param args {object} keys: classes, choices, question, filterFunction
@return the choice.
Asks the user for one or more choices .