diff --git a/bin/index.js b/bin/index.js index 4d99d38..0f44702 100644 --- a/bin/index.js +++ b/bin/index.js @@ -28,7 +28,7 @@ const baseConfig = { motd: "{bold}Welcome {cyan}%username%{reset}{bold} to {cyan}KannaShell v%ver%!\n", askOnExit: true } -if(!utils.config()) fs.appendFileSync(`${require("os").userInfo().homedir}\\.kannashell\\config.json`, JSON.stringify(baseConfig)) +if(!utils.config()) fs.appendFileSync(`${require("os").userInfo().homedir}\\.kannaconf.json`, JSON.stringify(baseConfig, null, 4)) // Put available commands in an array. fs.readdirSync(__dirname + "/commands/").filter(c => c.endsWith('.js')).forEach(c => {commands.push(c.slice(0, -3))}) @@ -82,16 +82,18 @@ utils.displayMOTD() prompt() ci.on('SIGINT', () => { - if(!config.askOnExit) { + if(!utils.config().askOnExit) { ci.close() } else { - ci.question("Are you sure that you want to exit?", (ans) => { - if(ans.match(/^y(es)?$/i)) ci.close() + console.log("") + ci.question("Are you sure that you want to exit? ", (ans) => { + if(ans.match(/^y(es)?$/i)) return ci.close() + prompt() }) } }); ci.on('close', () => { - console.log("\nGoodbye!") + console.log("Goodbye!") process.exit(0) }); \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 3547c34..d20e167 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,5 +1,5 @@ { "name": "kannashell", - "version": "0.0.19", + "version": "0.0.20", "lockfileVersion": 1 } diff --git a/package.json b/package.json index e0bd0c1..b772d61 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "kannashell", - "version": "0.0.19", + "version": "0.0.20", "description": "A small, light terminal shell for Windows.", "main": "bin/index.js", "scripts": { diff --git a/src/utils.js b/src/utils.js index 30674c5..5bcb6e3 100644 --- a/src/utils.js +++ b/src/utils.js @@ -14,6 +14,7 @@ */ const os = require("os") +const fs = require("fs") const { colorMap } = require("./colorMap.json") const Path = require("./Path.js") @@ -51,11 +52,11 @@ class KannaUtils { } static config() { - if(require("fs").existsSync(`${os.userInfo().homedir}\\.kannashell\\config.json`)) { - return JSON.parse(require("fs").readFileSync(`${os.userInfo().homedir}\\.kannashell\\config.json`)) - } else { - return false; - } + if(require("fs").existsSync(`${os.userInfo().homedir}\\.kannaconf.json`)) { + return JSON.parse(require("fs").readFileSync(`${os.userInfo().homedir}\\.kannaconf.json`)) + } else { + return false; + } } }