diff --git a/src/command-line/config.js b/src/command-line/config.js index 32e54426..e01a7157 100644 --- a/src/command-line/config.js +++ b/src/command-line/config.js @@ -1,7 +1,19 @@ +var fs = require("fs"); +var path = require("path"); var program = require("commander"); +var mkdirp = require("mkdirp"); var child = require("child_process"); +var Helper = require("../helper"); -var CONFIG_PATH = process.cwd() + "/config.js"; +var CONFIG_PATH = process.env.SHOUT_CONFIG; +if(!CONFIG_PATH) { + CONFIG_PATH = Helper.resolveHomePath("config.js"); +} +if(!fs.exists(CONFIG_PATH)) { + mkdirp.sync(Helper.getHomeDirectory()); + var configFile = fs.readFileSync(path.resolve(__dirname, "..", "..", "config.js")); + fs.writeFileSync(CONFIG_PATH, configFile); +} program .command("config")