Skip to content

Commit

Permalink
fix --sort
Browse files Browse the repository at this point in the history
  • Loading branch information
Unitech committed Jan 22, 2018
1 parent de740ab commit d956f5c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
2 changes: 1 addition & 1 deletion bin/pm2
Original file line number Diff line number Diff line change
Expand Up @@ -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 <field_name:sort>', 'sort process according to field\'s name')
.usage('[cmd] app');

commander.on('--help', function() {
Expand Down
8 changes: 1 addition & 7 deletions lib/API/CliUx.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit d956f5c

Please sign in to comment.