diff options
author | TheArcaneBrony <myrainbowdash949@gmail.com> | 2022-08-23 19:02:05 +0200 |
---|---|---|
committer | TheArcaneBrony <myrainbowdash949@gmail.com> | 2022-08-23 19:02:05 +0200 |
commit | ba0ba4b61ede1404454b8ab89bd9da61851f8a6e (patch) | |
tree | 254cf1238adea372014b55555e22db6637683d72 /scripts/utils/ask.js | |
parent | Merge remote-tracking branch 'Puyodead1/patch/prettier-config' into staging (diff) | |
parent | New db migration script - multiplatform, fix mariadb migrations (diff) | |
download | server-ba0ba4b61ede1404454b8ab89bd9da61851f8a6e.tar.xz |
Merge branch 'dev/cherry-plugins-improvements' into staging
Diffstat (limited to 'scripts/utils/ask.js')
-rw-r--r-- | scripts/utils/ask.js | 20 |
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 |