summary refs log tree commit diff
path: root/scripts/utils/ask.js
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/utils/ask.js')
-rw-r--r--scripts/utils/ask.js20
1 files changed, 20 insertions, 0 deletions
diff --git a/scripts/utils/ask.js b/scripts/utils/ask.js
new file mode 100644
index 00000000..cb8a29f6
--- /dev/null
+++ b/scripts/utils/ask.js
@@ -0,0 +1,20 @@
+const readline = require("readline");
+const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
+
+async function ask(question) {
+	return new Promise((resolve, _reject) => {
+		return rl.question(question, (answer) => {
+			resolve(answer);
+		});
+	}).catch((err) => {
+		console.log(err);
+	});
+}
+async function askBool(question) {
+	return /y?/i.test(await ask(question));
+}
+
+module.exports = {
+    ask,
+    askBool
+}
\ No newline at end of file