Skip to content

Commit 4bdf621

Browse files
committedMay 2, 2016
Base#prompt now return a promise
1 parent 2d90140 commit 4bdf621

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed
 

‎lib/base.js

+4-8
Original file line numberDiff line numberDiff line change
@@ -223,24 +223,20 @@ Base.prototype.welcome = deprecate(
223223
* user's answers as defaults.
224224
*
225225
* @param {array} questions Array of question descriptor objects. See {@link https://github.com/SBoudrias/Inquirer.js/blob/master/README.md Documentation}
226-
* @param {Function} callback Receive a question object
227-
* @return {this}
226+
* @return {Promise}
228227
*/
229228

230-
Base.prototype.prompt = function (questions, callback) {
229+
Base.prototype.prompt = function (questions) {
231230
questions = promptSuggestion.prefillQuestions(this._globalConfig, questions);
232231

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

238-
if (_.isFunction(callback)) {
239-
callback(answers);
240-
}
237+
return answers;
241238
}.bind(this));
242239

243-
return this;
244240
};
245241

246242
/**

0 commit comments

Comments
 (0)
Please sign in to comment.