summary refs log tree commit diff
path: root/scripts/utils/ask.js
diff options
context:
space:
mode:
authorTheArcaneBrony <myrainbowdash949@gmail.com>2022-08-23 19:02:05 +0200
committerTheArcaneBrony <myrainbowdash949@gmail.com>2022-08-23 19:02:05 +0200
commitba0ba4b61ede1404454b8ab89bd9da61851f8a6e (patch)
tree254cf1238adea372014b55555e22db6637683d72 /scripts/utils/ask.js
parentMerge remote-tracking branch 'Puyodead1/patch/prettier-config' into staging (diff)
parentNew db migration script - multiplatform, fix mariadb migrations (diff)
downloadserver-ba0ba4b61ede1404454b8ab89bd9da61851f8a6e.tar.xz
Merge branch 'dev/cherry-plugins-improvements' into staging
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