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) {