UNPKG

liveperson-functions-cli

Version:
47 lines 1.25 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Prompt = void 0; const Inquirer = require("inquirer"); /** * {@link https://www.npmjs.com/package/inquirer} * @export * @class Prompt */ class Prompt { constructor(inquirer = Inquirer) { this.prompts = []; this.inquirer = inquirer; } /** * Adds a question to the prompt * @param {(IPromptAnswer | IPromptAnswer[])} question - question * @returns {Prompt} - Instance of prompt * @memberof Prompt */ addQuestion(question) { Array.isArray(question) ? (this.prompts = this.prompts.concat(question)) : this.prompts.push(question); return this; } /** * Return the prompts * @returns {IPromptAnswer[]} - prompts * @memberof Prompt */ getQuestions() { return this.prompts; } /** * Runs the prompt and gather all answers * @returns {Promise<IPromptAnswer[]>} - prompt answers * @memberof Prompt */ async run() { const answers = await this.inquirer.prompt(this.prompts); this.prompts = []; return answers; } } exports.Prompt = Prompt; //# sourceMappingURL=prompt.js.map