diff --git a/bin/pm2 b/bin/pm2 index a76efdba2..aeb4aa481 100755 --- a/bin/pm2 +++ b/bin/pm2 @@ -84,7 +84,7 @@ commander.version(pkg.version) .option('--trace', 'enable transaction tracing with km') .option('--disable-trace', 'disable transaction tracing with km') .option('--attach', 'attach logging after your start/restart/stop/reload') - .option('--sort', 'sort process according to field\'s name') + .option('--sort ', 'sort process according to field\'s name') .usage('[cmd] app'); commander.on('--help', function() { diff --git a/lib/API/CliUx.js b/lib/API/CliUx.js index ade73f72f..a25f72e01 100644 --- a/lib/API/CliUx.js +++ b/lib/API/CliUx.js @@ -230,13 +230,7 @@ UX.dispAsTable = function(list, commander) { }; if(commander && commander.sort) { - - for(var i = 0; i < commander.rawArgs.length; i++) { - if(commander.rawArgs[i].indexOf('--sort=') === 0) { - sort = commander.rawArgs[i].replace('--sort=', '').split(':'); - break; - } - } + sort = commander.sort.split(':'); if(fields[sort[0].toLowerCase()]) { sortField = sort[0].toLowerCase();