From 4b21c319c23a43eb6557bedfbfef3f1840bb20f3 Mon Sep 17 00:00:00 2001 From: Mattias Erming Date: Tue, 5 Aug 2014 01:32:25 -0700 Subject: [PATCH] Turn index.js into an executable --- index.js | 23 ++++++++++++++++++++--- package.json | 3 ++- src/server.js | 4 +++- 3 files changed, 25 insertions(+), 5 deletions(-) mode change 100644 => 100755 index.js diff --git a/index.js b/index.js old mode 100644 new mode 100755 index 458ebefd..38af7c4f --- a/index.js +++ b/index.js @@ -1,3 +1,20 @@ -process.chdir(__dirname); -var shout = require("./src/server"); -shout(); +#!/usr/bin/env node + +process.chdir(__dirname); + +var program = require("commander"); +var shout = require("./src/server.js"); +var version = require("./package.json").version; + +program + .command("start") + .description("Starts the server.") + .action(function() { + shout(); + }); + +program.parse(process.argv) + +if (!program.args.length) { + program.help(); +} diff --git a/package.json b/package.json index b7299bd8..08765d41 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "shout", "description": "A web IRC client", - "version": "0.8.10", + "version": "0.8.11", "homepage": "http://github.com/erming/shout", "author": { "name": "Mattias Erming", @@ -33,6 +33,7 @@ "url": "https://github.com/erming/shout.git" }, "dependencies": { + "commander": "^2.3.0", "connect": "~2.19.6", "lodash": "~2.4.1", "moment": "~2.7.0", diff --git a/src/server.js b/src/server.js index 33c82c57..e8c11841 100644 --- a/src/server.js +++ b/src/server.js @@ -41,8 +41,10 @@ module.exports = function() { } }); - console.log("Server started."); + console.log(""); console.log("Shout is now running on port " + port); + console.log("Press ctrl-c to stop"); + console.log(""); if (config.public) { return;