Skip to content

Commit

Permalink
fixed newline output after help information
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredpetersen committed Jul 29, 2018
1 parent 28ff02a commit 238102a
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions index.js
Expand Up @@ -1130,6 +1130,7 @@ Command.prototype.helpInformation = function() {
.concat(desc)
.concat(options)
.concat(cmds)
.concat([''])

This comment has been minimized.

Copy link
@roman-vanesyan

roman-vanesyan Aug 2, 2018

Collaborator

Can you add this as the last element to the cmds array, as it's done with all other blocks, like options, etc

.join('\n');
};

Expand Down
24 changes: 24 additions & 0 deletions test/test.command.helpInformation.js
@@ -0,0 +1,24 @@
var program = require('../')
, sinon = require('sinon').sandbox.create()
, should = require('should');


program.command('somecommand');
program.command('anothercommand [options]');

var expectedHelpInformation = [
'',
' Usage: [options] [command]',
'',
' Options:',
'',
' -h, --help output usage information',
'',
' Commands:',
'',
' somecommand',
' anothercommand [options]',
'\n'
].join('\n');

program.helpInformation().should.equal(expectedHelpInformation);

0 comments on commit 238102a

Please sign in to comment.