Skip to content

Commit 882dc66

Browse files
author
Dom Harrington
committed
Fix rdme --version
I think this broke here: 10ab760 when i defaulted to `help`
1 parent cffb509 commit 882dc66

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

cli.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ function load(command = '', subcommand = '') {
2929
}
3030

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

3434
let command = cmd || '';
3535
let subcommand;

test/cli.test.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ describe('cli', () => {
1717
it('should return version from package.json', () =>
1818
cli('', [], minimist(['--version'])).then(v => assert.equal(v, version)));
1919

20+
it('should return version from package.json for help command', () =>
21+
cli('help', [], minimist(['--version'])).then(v => assert.equal(v, version)));
22+
2023
// This is necessary because we use --version for other commands like `docs`
2124
it('should only return version if no command', () =>
2225
cli('no-such-command', [], minimist(['--version']))

0 commit comments

Comments
 (0)