diff --git a/config.json b/config.json index 597f545d..60e4b9a1 100644 --- a/config.json +++ b/config.json @@ -1,5 +1,5 @@ { "port": 9000, "theme": "themes/example.css", - "public": false + "public": true } diff --git a/index.js b/index.js index 87f4ec37..88ac8b7a 100755 --- a/index.js +++ b/index.js @@ -8,26 +8,26 @@ var shout = require("./src/server.js"); var fs = require("fs"); program - .option("-p, --port ") - .option("-P, --public"); + .option("-p, --port "); program .command("start") .description("Start the server") .action(function() { var users = new ClientManager().getUsers(); - if (!program.public && !users.length) { + if (!config.public && !users.length) { console.log(""); console.log("No users found!"); console.log("Create a new user with 'shout add-user '.") console.log(""); } else { - shout(program.port, program.public); + var port = program.port || config.port; + shout(port, config.public); } }); program - .command("list-users") + .command("list") .description("List all existing users") .action(function() { var users = new ClientManager().getUsers(); @@ -39,14 +39,14 @@ program console.log(""); console.log("Users:"); for (var i = 0; i < users.length; i++) { - console.log((i + 1) + ": " + users[i]); + console.log(" " + (i + 1) + ". " + users[i]); } console.log(""); } }); program - .command("add-user ") + .command("add ") .description("Add a new user") .action(function(name) { try { @@ -86,7 +86,7 @@ program }); program - .command("remove-user ") + .command("remove ") .description("Remove an existing user") .action(function(name) { try { @@ -117,5 +117,5 @@ program program.parse(process.argv) if (!program.args.length) { - program.help(); + program.parse(process.argv.concat("start")); } diff --git a/package.json b/package.json index b1c27c0b..d6dadd2f 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "shout", "description": "A web IRC client", - "version": "0.9.11", + "version": "0.10.0", "author": "Mattias Erming", "preferGlobal": true, "bin": { diff --git a/src/server.js b/src/server.js index f17ab85a..0275ba6a 100644 --- a/src/server.js +++ b/src/server.js @@ -26,9 +26,9 @@ var inputs = [ "whois" ]; -module.exports = function(port, public) { - config.port = port || config.port, - config.public = public || config.public +module.exports = function(port, isPublic) { + config.port = port; + config.public = isPublic; var app = http() .use(index)