Skip to content

Commit

Permalink
Fix rdme --help
Browse files Browse the repository at this point in the history
  • Loading branch information
Dom Harrington committed Oct 8, 2018
1 parent 882dc66 commit 6f02cc1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function load(command = '', subcommand = '') {
}

module.exports = function(cmd, args, opts = {}) {
if (opts.version && !cmd || cmd === 'help') return Promise.resolve(version);
if (opts.version && (!cmd || cmd === 'help')) return Promise.resolve(version);

let command = cmd || '';
let subcommand;
Expand Down
5 changes: 4 additions & 1 deletion test/cli.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ describe('cli', () => {
});

describe('--help', () => {
it('should print help and not error', () => cli('', [], minimist(['--help'])));
it('should print help and not version', () =>
cli('help', [], minimist(['--help'])).then(output => {
assert.notEqual(output, version);
}));
});

describe('subcommands', () => {
Expand Down

0 comments on commit 6f02cc1

Please sign in to comment.