We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 986c49e commit 8fa6239Copy full SHA for 8fa6239
2 files changed
run.js
@@ -1 +1,23 @@
1
const prompt = require("prompt-sync")
2
+const chalk = require("chalk")
3
+const path = require('path');
4
+const warn = function(message, color){
5
+ if (!color) color = red
6
+ console.log(chalk[color](message))
7
+}
8
+
9
10
+if (path.existsSync("/data")) { // or fs.existsSync
11
+ warn("WARNING: Folder \"data\" will be erased and rebuilt if you proceed")
12
+ const answer = prompt("Would you like to proceed? (S/N)")
13
+ if (String(answer).toUpperCase=="S"){
14
+ //delete
15
+ console.log("Done")
16
+ } else if (String(answer).toUpperCase=="N"){
17
+ console.log("Goodbye!")
18
+ exit(0)
19
+ }else{
20
+ warn("Not a valid answer. Exiting...")
21
+ exit(1)
22
+ }
23
tools/lib.js
0 commit comments