summary refs log tree commit diff
path: root/scripts/utils/ask.js
diff options
context:
space:
mode:
authorMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2022-08-30 15:05:23 +1000
committerMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2022-08-30 15:08:18 +1000
commit16315a3170ec018a834e68360e06b506415446d2 (patch)
tree90cfe456040fce35b904e88462886e3c73a2f3f2 /scripts/utils/ask.js
parentStart listening after database and config has been loaded (diff)
parentOop, deprecated typeorm call (diff)
downloadserver-16315a3170ec018a834e68360e06b506415446d2.tar.xz
Merge branch 'staging' into dev/Maddy/fix/listeningAfterDb
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