From 2bcc53d270ad51e04b87896d50bb9b76afaa7202 Mon Sep 17 00:00:00 2001 From: indexzero Date: Mon, 15 Nov 2010 23:49:57 -0500 Subject: [PATCH] [bin dist] Version bump. Small fixes from 0.2.5 --- bin/forever | 17 ++++++++++++++--- package.json | 4 ++-- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/bin/forever b/bin/forever index 8b637698..bf1f1d0a 100755 --- a/bin/forever +++ b/bin/forever @@ -57,8 +57,10 @@ var mappings = { 'e': 'errfile' }; -// Show help prompt if requested -if (argv.h || argv.help) { +// Show help prompt if requested or if the +// incorrect usage options are supplied +if (argv.h || argv.help || Object.keys(argv).length === 2 + || argv._.length === 0) { sys.puts(help); return; } @@ -70,7 +72,16 @@ var file = argv._[0]; // Setup pass-thru options for child-process var options = {}; -options.options = process.argv.splice(process.argv.indexOf(file) + 1); +options.options = process.argv.splice(process.argv.indexOf(file)).splice(1); + +// Now that we've removed the target script options +// reparse the options and setup the forever settings +argv = require('optimist').argv; +Object.keys(argv).forEach(function (key) { + if (mappings[key]) { + options[mappings[key]] = argv[key]; + } +}); // If max isn't specified set it to run forever if (typeof options['max'] === 'undefined') { diff --git a/package.json b/package.json index ace57eb7..77d494d1 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "forever", "description": "A simple CLI tool for ensuring that a given node script runs continuously (i.e. forever)", - "version": "0.2.5", + "version": "0.2.6", "author": "Charlie Robbins ", "contributors": [ { "name": "Fedor Indutny", "email": "fedor.indutny@gmail.com" } @@ -13,7 +13,7 @@ "keywords": ["cli", "fault tolerant", "sysadmin", "tools"], "dependencies": { "daemon": ">= 0.1.0", - "optimist": ">= 0.0.3", + "optimist": ">= 0.0.6", "vows": ">= 0.5.1", }, "bin": { "forever": "./bin/forever" },