prompts.js 746 B

12345678910111213141516171819
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.createOnFallback = void 0;
  4. const color_1 = require("./color");
  5. function createOnFallback({ flags: { confirm }, log }) {
  6. return (question) => {
  7. if (question.type === 'confirm') {
  8. if (confirm) {
  9. log.msg(`${(0, color_1.input)('--confirm')}: ${(0, color_1.weak)(question.message)} ${(0, color_1.ancillary)('Yes')}`);
  10. return true;
  11. }
  12. else {
  13. log.msg(`${(0, color_1.input)('--no-confirm')}: ${(0, color_1.weak)(question.message)} ${(0, color_1.ancillary)('No')}`);
  14. return false;
  15. }
  16. }
  17. };
  18. }
  19. exports.createOnFallback = createOnFallback;