2014-08-19 01:18:40 +00:00
|
|
|
var program = require("commander");
|
2014-08-26 18:15:17 +00:00
|
|
|
var pkg = require("../../package.json");
|
2014-10-03 23:33:44 +00:00
|
|
|
var fs = require("fs");
|
|
|
|
var mkdirp = require("mkdirp");
|
|
|
|
var Helper = require("../helper");
|
2014-08-19 01:18:40 +00:00
|
|
|
|
2014-09-15 19:50:57 +00:00
|
|
|
program.version(pkg.version, "-v, --version");
|
2014-10-03 23:33:44 +00:00
|
|
|
program.option("");
|
|
|
|
program.option(" --home <path>", "home path");
|
2014-09-15 19:50:57 +00:00
|
|
|
|
2014-08-19 01:18:40 +00:00
|
|
|
require("./start");
|
2014-08-19 01:53:17 +00:00
|
|
|
require("./config");
|
2014-08-19 01:18:40 +00:00
|
|
|
require("./list");
|
|
|
|
require("./add");
|
|
|
|
require("./remove");
|
2014-09-11 21:00:08 +00:00
|
|
|
require("./reset");
|
2014-08-25 00:19:03 +00:00
|
|
|
require("./edit");
|
2014-08-19 01:18:40 +00:00
|
|
|
|
2014-08-26 18:15:17 +00:00
|
|
|
program.parse(process.argv);
|
2014-08-19 01:18:40 +00:00
|
|
|
|
2014-10-03 23:33:44 +00:00
|
|
|
if (program.home) {
|
|
|
|
Helper.HOME = program.home;
|
|
|
|
} else {
|
|
|
|
var config = Helper.HOME + "/config.js";
|
|
|
|
if (!fs.existsSync(config)) {
|
|
|
|
mkdirp.sync(Helper.HOME);
|
|
|
|
fs.writeFileSync(config, fs.readFileSync(__dirname + "/../../config.js"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-08-19 01:18:40 +00:00
|
|
|
if (!program.args.length) {
|
|
|
|
program.parse(process.argv.concat("start"));
|
|
|
|
}
|