Merge pull request #929 from msaun008/msaun008/fix-command-line-arg-parsing

Update arg parsing and default 'lounge' to 'lounge --help'
This commit is contained in:
Pavel Djundik 2017-03-10 19:27:09 +02:00 committed by GitHub
commit 24bd39361b
3 changed files with 11 additions and 13 deletions

View File

@ -13,7 +13,7 @@
"homepage": "https://thelounge.github.io/", "homepage": "https://thelounge.github.io/",
"scripts": { "scripts": {
"coverage": "nyc mocha", "coverage": "nyc mocha",
"start": "node index", "start": "node index start",
"start-dev": "npm-run-all --parallel watch start", "start-dev": "npm-run-all --parallel watch start",
"build": "npm-run-all build:*", "build": "npm-run-all build:*",
"build:font-awesome": "node scripts/build-fontawesome.js", "build:font-awesome": "node scripts/build-fontawesome.js",

View File

@ -9,11 +9,9 @@ var fsextra = require("fs-extra");
var path = require("path"); var path = require("path");
var Helper = require("../helper"); var Helper = require("../helper");
program.version(Helper.getVersion(), "-v, --version"); program.version(Helper.getVersion(), "-v, --version")
program.option(""); .option("-h, --home <path>", "path to configuration folder")
program.option(" --home <path>" , "home path"); .parseOptions(process.argv);
var argv = program.parseOptions(process.argv);
Helper.setHome(program.home || process.env.LOUNGE_HOME); Helper.setHome(program.home || process.env.LOUNGE_HOME);
@ -40,8 +38,8 @@ require("./remove");
require("./reset"); require("./reset");
require("./edit"); require("./edit");
program.parse(argv.args); program.parse(process.argv);
if (!program.args.length) { if (!program.args.length) {
program.parse(process.argv.concat("start")); program.help();
} }

View File

@ -8,11 +8,11 @@ var Helper = require("../helper");
program program
.command("start") .command("start")
.option("-H, --host <ip>", "host") .option("-H, --host <ip>", "set the IP address or hostname for the web server to listen on")
.option("-P, --port <port>", "port") .option("-P, --port <port>", "set the port to listen on")
.option("-B, --bind <ip>", "bind") .option("-B, --bind <ip>", "set the local IP to bind to for outgoing connections")
.option(" --public", "mode") .option(" --public", "start in public mode")
.option(" --private", "mode") .option(" --private", "start in private mode")
.description("Start the server") .description("Start the server")
.action(function(options) { .action(function(options) {
var users = new ClientManager().getUsers(); var users = new ClientManager().getUsers();