From 86ed0b6e59f1e53b9967f3344b4dd68de0cd6ca2 Mon Sep 17 00:00:00 2001 From: Matthew Saunders Date: Fri, 17 Feb 2017 22:23:01 -0500 Subject: [PATCH] Update arg parsing and default 'lounge' to 'lounge --help' --- package.json | 2 +- src/command-line/index.js | 12 +++++------- src/command-line/start.js | 10 +++++----- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/package.json b/package.json index 4bc23e39..e51320e5 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "homepage": "https://thelounge.github.io/", "scripts": { "coverage": "nyc mocha", - "start": "node index", + "start": "node index start", "start-dev": "npm-run-all --parallel watch start", "build": "npm-run-all build:*", "build:font-awesome": "node scripts/build-fontawesome.js", diff --git a/src/command-line/index.js b/src/command-line/index.js index 1149f939..46ba56cb 100644 --- a/src/command-line/index.js +++ b/src/command-line/index.js @@ -9,11 +9,9 @@ var fsextra = require("fs-extra"); var path = require("path"); var Helper = require("../helper"); -program.version(Helper.getVersion(), "-v, --version"); -program.option(""); -program.option(" --home " , "home path"); - -var argv = program.parseOptions(process.argv); +program.version(Helper.getVersion(), "-v, --version") + .option("-h, --home ", "path to configuration folder") + .parseOptions(process.argv); Helper.setHome(program.home || process.env.LOUNGE_HOME); @@ -40,8 +38,8 @@ require("./remove"); require("./reset"); require("./edit"); -program.parse(argv.args); +program.parse(process.argv); if (!program.args.length) { - program.parse(process.argv.concat("start")); + program.help(); } diff --git a/src/command-line/start.js b/src/command-line/start.js index 9a5fdbbd..f1c6ca10 100644 --- a/src/command-line/start.js +++ b/src/command-line/start.js @@ -8,11 +8,11 @@ var Helper = require("../helper"); program .command("start") - .option("-H, --host ", "host") - .option("-P, --port ", "port") - .option("-B, --bind ", "bind") - .option(" --public", "mode") - .option(" --private", "mode") + .option("-H, --host ", "set the IP address or hostname for the web server to listen on") + .option("-P, --port ", "set the port to listen on") + .option("-B, --bind ", "set the local IP to bind to for outgoing connections") + .option(" --public", "start in public mode") + .option(" --private", "start in private mode") .description("Start the server") .action(function(options) { var users = new ClientManager().getUsers();