UNPKG

@o3r/schematics

Version:

Schematics module of the Otter framework

24 lines 776 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.askUserInput = void 0; const node_readline_1 = require("node:readline"); /** * Display a question in the terminal and wait for the user answer * @param question Question to ask to the user * @returns user's answer */ const askUserInput = async (question) => { const readline = (0, node_readline_1.createInterface)({ terminal: true, input: process.stdin, output: process.stdout }); const askQuestion = () => new Promise((resolve) => { readline.question(`${question} `, resolve); }); const answer = await askQuestion(); readline.close(); return answer; }; exports.askUserInput = askUserInput; //# sourceMappingURL=question.js.map