1c732ffc5b
In v2.2.1 (and in pretty much every software out there, really), `-h` was an alias of `--help`. By adding it as an alias of `--home`, it is now shown twice in the help.
46 lines
1.0 KiB
JavaScript
46 lines
1.0 KiB
JavaScript
"use strict";
|
|
|
|
global.log = require("../log.js");
|
|
|
|
var program = require("commander");
|
|
var colors = require("colors/safe");
|
|
var fs = require("fs");
|
|
var fsextra = require("fs-extra");
|
|
var path = require("path");
|
|
var Helper = require("../helper");
|
|
|
|
program.version(Helper.getVersion(), "-v, --version")
|
|
.option("--home <path>", "path to configuration folder")
|
|
.parseOptions(process.argv);
|
|
|
|
Helper.setHome(program.home || process.env.LOUNGE_HOME);
|
|
|
|
if (!fs.existsSync(Helper.CONFIG_PATH)) {
|
|
fsextra.ensureDirSync(Helper.HOME);
|
|
fs.chmodSync(Helper.HOME, "0700");
|
|
fsextra.copySync(path.resolve(path.join(
|
|
__dirname,
|
|
"..",
|
|
"..",
|
|
"defaults",
|
|
"config.js"
|
|
)), Helper.CONFIG_PATH);
|
|
log.info(`Configuration file created at ${colors.green(Helper.CONFIG_PATH)}.`);
|
|
}
|
|
|
|
fsextra.ensureDirSync(Helper.USERS_PATH);
|
|
|
|
require("./start");
|
|
require("./config");
|
|
require("./list");
|
|
require("./add");
|
|
require("./remove");
|
|
require("./reset");
|
|
require("./edit");
|
|
|
|
program.parse(process.argv);
|
|
|
|
if (!program.args.length) {
|
|
program.help();
|
|
}
|