From 65fa45ba982822ae22a9b7daedba0508ec8b435a Mon Sep 17 00:00:00 2001 From: soyuka Date: Wed, 2 Apr 2014 08:45:39 +0200 Subject: [PATCH] Added --watch option to start command --- bin/pm2 | 1 + lib/CLI.js | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/bin/pm2 b/bin/pm2 index 53db2071..58612d43 100755 --- a/bin/pm2 +++ b/bin/pm2 @@ -70,6 +70,7 @@ function failOnUnknown(fn) { // commander.command('start ') .description('start specific processes') + .option('--watch', 'Watch folder for changes') .action(function(cmd) { if (cmd == "-") { process.stdin.resume(); diff --git a/lib/CLI.js b/lib/CLI.js index c6c919e0..feb5eb61 100644 --- a/lib/CLI.js +++ b/lib/CLI.js @@ -77,6 +77,9 @@ CLI.startFile = function(script) { fs.writeFileSync(dst_path, JSON.stringify(appConf)); } + if(commander.rawArgs.indexOf('--watch') !== -1) + appConf['watch'] = true; + /* * Re start script name that is already launched */ @@ -151,6 +154,9 @@ CLI.startFromJson = function(cmd,jsonVia) { var appConf = JSON.parse(data); } + if(commander.rawArgs.indexOf('--watch') !== -1) + appConf['watch'] = true; + if (!Array.isArray(appConf)) appConf = [appConf]; //convert to array (function ex(apps) {