From 14e573899745d673f945d52dca34e7ea2e5d11d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Valentin=20Trinqu=C3=A9?= Date: Mon, 3 Jul 2017 11:01:15 +0200 Subject: [PATCH] Fix help section order and padding (#652) * Change help section order Fixes tj/commander.js#500 Previous display order : Usage > Commands > Description > Options New display order: Usage > Description > Options > Commands * Fix inconsistent padding between help sections --- examples/pm | 1 + index.js | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/examples/pm b/examples/pm index baac7816f..2d0506441 100755 --- a/examples/pm +++ b/examples/pm @@ -4,6 +4,7 @@ var program = require('..'); program .version('0.0.1') + .description('Fake package manager') .command('install [name]', 'install one or more packages').alias('i') .command('search [query]', 'search with optional query').alias('s') .command('list', 'list packages installed') diff --git a/index.js b/index.js index 86d82bdbb..d5dbe1868 100644 --- a/index.js +++ b/index.js @@ -1021,17 +1021,17 @@ Command.prototype.helpInformation = function() { if (commandHelp) cmds = [commandHelp]; var options = [ - ' Options:' + '' + , ' Options:' , '' , '' + this.optionHelp().replace(/^/gm, ' ') , '' - , '' ]; return usage - .concat(cmds) .concat(desc) .concat(options) + .concat(cmds) .join('\n'); };