diff --git a/index.js b/index.js new file mode 100644 index 0000000..9716aae --- /dev/null +++ b/index.js @@ -0,0 +1,50 @@ + +'use strict'; + + +//checking if first process arg is "init" +if(process.argv[2] === "init") { +const fs = require('fs'); + + +const readline = require('readline'); + +const rl = readline.createInterface({ + input: process.stdin, + output: process.stdout +}); + + + +// console.log(process.argv) + +// const jsonObj = {} +// if(process.argv[2] === "init") { + // console.log(process.argv[2]) +rl.question("input number 1 ", (input1) => { + rl.question("input number 2 ", (input2) => { + rl.question("input number 3 ", (input3) => { + rl.question("input number 4 ", (input4) => { + rl.question("input number 5 ", (input5) => { + console.log(`${input1},${input2},${input3},${input4},${input5},`) + const obj = `{ + "input1" : ${input1}, + "input2" : ${input2}, + "input3" : ${input3}, + "input4" : ${input4}, + "input5" : ${input5}, + }` + const jsonString= JSON.stringify(obj); + fs.writeFile("package.json", jsonString, function (err) { + if (err) throw err; + console.log('Already Saved!'); + }) + + return rl.close() + }) + }) + }) + }) +}) +} + diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..623c9e2 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,5 @@ +{ + "name": "acapm", + "version": "1.0.0", + "lockfileVersion": 1 +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..919ae4d --- /dev/null +++ b/package.json @@ -0,0 +1 @@ +"{\n \"input1\" : 2,\n \"input2\" : 3,\n \"input3\" : 3,\n \"input4\" : 4,\n \"input5\" : 5,\n }" \ No newline at end of file