1 | "use strict";
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 | var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
10 | if (k2 === undefined) k2 = k;
|
11 | Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
12 | }) : (function(o, m, k, k2) {
|
13 | if (k2 === undefined) k2 = k;
|
14 | o[k2] = m[k];
|
15 | }));
|
16 | var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
17 | Object.defineProperty(o, "default", { enumerable: true, value: v });
|
18 | }) : function(o, v) {
|
19 | o["default"] = v;
|
20 | });
|
21 | var __importStar = (this && this.__importStar) || function (mod) {
|
22 | if (mod && mod.__esModule) return mod;
|
23 | var result = {};
|
24 | if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
25 | __setModuleDefault(result, mod);
|
26 | return result;
|
27 | };
|
28 | Object.defineProperty(exports, "__esModule", { value: true });
|
29 | exports.askConfirmation = void 0;
|
30 | const inquirer = __importStar(require("inquirer"));
|
31 | const tty_1 = require("./tty");
|
32 | async function askConfirmation(message, defaultResponse, noTTYResponse) {
|
33 | if (!tty_1.isTTY()) {
|
34 | return noTTYResponse !== null && noTTYResponse !== void 0 ? noTTYResponse : defaultResponse;
|
35 | }
|
36 | const question = {
|
37 | type: 'confirm',
|
38 | name: 'confirmation',
|
39 | prefix: '',
|
40 | message,
|
41 | default: defaultResponse,
|
42 | };
|
43 | const answers = await inquirer.prompt([question]);
|
44 | return answers['confirmation'];
|
45 | }
|
46 | exports.askConfirmation = askConfirmation;
|