Nav apraksta
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

12345678910111213141516171819202122232425262728293031
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.promptOnce = exports.prompt = void 0;
  4. const inquirer = require("inquirer");
  5. const error_1 = require("./error");
  6. async function prompt(options, questions) {
  7. const prompts = [];
  8. for (const question of questions) {
  9. if (question.name && options[question.name] === undefined) {
  10. prompts.push(question);
  11. }
  12. }
  13. if (prompts.length && options.nonInteractive) {
  14. const missingOptions = Array.from(new Set(prompts.map((p) => p.name))).join(", ");
  15. throw new error_1.FirebaseError(`Missing required options (${missingOptions}) while running in non-interactive mode`, {
  16. children: prompts,
  17. });
  18. }
  19. const answers = await inquirer.prompt(prompts);
  20. Object.keys(answers).forEach((k) => {
  21. options[k] = answers[k];
  22. });
  23. return answers;
  24. }
  25. exports.prompt = prompt;
  26. async function promptOnce(question, options = {}) {
  27. question.name = question.name || "question";
  28. await prompt(options, [question]);
  29. return options[question.name];
  30. }
  31. exports.promptOnce = promptOnce;