Skip to content

Commit

Permalink
Base#prompt now return a promise
Browse files Browse the repository at this point in the history
  • Loading branch information
SBoudrias committed May 2, 2016
1 parent 2d90140 commit 4bdf621
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions lib/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,24 +223,20 @@ Base.prototype.welcome = deprecate(
* user's answers as defaults.
*
* @param {array} questions Array of question descriptor objects. See {@link https://github.com/SBoudrias/Inquirer.js/blob/master/README.md Documentation}
* @param {Function} callback Receive a question object
* @return {this}
* @return {Promise}
*/

Base.prototype.prompt = function (questions, callback) {
Base.prototype.prompt = function (questions) {
questions = promptSuggestion.prefillQuestions(this._globalConfig, questions);

this.env.adapter.prompt(questions, function (answers) {
return this.env.adapter.prompt(questions).then(function (answers) {
if (!this.options['skip-cache']) {
promptSuggestion.storeAnswers(this._globalConfig, questions, answers);
}

if (_.isFunction(callback)) {
callback(answers);
}
return answers;
}.bind(this));

return this;
};

/**
Expand Down

0 comments on commit 4bdf621

Please sign in to comment.