Skip to content

Commit

Permalink
fixed newline output after help information (#833)
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredpetersen authored and roman-vanesyan committed Aug 2, 2018
1 parent 28ff02a commit 6ddb8eb
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([''])
.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 6ddb8eb

Please sign in to comment.