Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: tj/commander.js
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v2.16.0
Choose a base ref
...
head repository: tj/commander.js
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v2.17.0
Choose a head ref
  • 5 commits
  • 6 files changed
  • 2 contributors

Commits on Jul 3, 2018

  1. npm update (#823)

    abetomo authored and roman-vanesyan committed Jul 3, 2018
    Copy the full SHA
    aaa447a View commit details

Commits on Jul 13, 2018

  1. Fix the path of tsc command (#824)

    Since there is a tsc command below `./node_modules/.bin`,
    `./node_modules/.bin` has been added to `PATH`.
    abetomo authored and roman-vanesyan committed Jul 13, 2018
    Copy the full SHA
    2d49ddf View commit details

Commits on Jul 17, 2018

  1. Fix to emit the action even without command (#778)

    * Fix to emit the action even without command
    
    * Fix to emit the action even without command
    abetomo authored and roman-vanesyan committed Jul 17, 2018
    Copy the full SHA
    28ff02a View commit details

Commits on Aug 2, 2018

  1. Copy the full SHA
    6ddb8eb View commit details

Commits on Aug 3, 2018

  1. version bump 2.17.0

    abetomo authored and roman-vanesyan committed Aug 3, 2018

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    25b06ee View commit details
Showing with 724 additions and 779 deletions.
  1. +7 −0 CHANGELOG.md
  2. +4 −0 index.js
  3. +669 −772 package-lock.json
  4. +7 −7 package.json
  5. +24 −0 test/test.command.helpInformation.js
  6. +13 −0 test/test.noCommand.action.js
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@

2.17.0 / 2018-08-03
==================

* fixed newline output after help information (#833)
* Fix to emit the action even without command (#778)
* npm update (#823)

2.16.0 / 2018-06-29
==================

4 changes: 4 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -660,6 +660,9 @@ Command.prototype.parseArgs = function(args, unknown) {
if (unknown.length > 0) {
this.unknownOption(unknown[0]);
}
if (this._args.filter(a => a.required).length === 0) {
this.emit('command:*');
}
}

return this;
@@ -1127,6 +1130,7 @@ Command.prototype.helpInformation = function() {
.concat(desc)
.concat(options)
.concat(cmds)
.concat([''])
.join('\n');
};

1,441 changes: 669 additions & 772 deletions package-lock.json

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "commander",
"version": "2.16.0",
"version": "2.17.0",
"description": "the complete solution for node.js command-line programs",
"keywords": [
"commander",
@@ -17,7 +17,7 @@
"scripts": {
"lint": "eslint index.js",
"test": "node test/run.js && npm run test-typings",
"test-typings": "node_modules/typescript/bin/tsc -p tsconfig.json"
"test-typings": "tsc -p tsconfig.json"
},
"main": "index",
"files": [
@@ -26,11 +26,11 @@
],
"dependencies": {},
"devDependencies": {
"@types/node": "^7.0.66",
"eslint": "^4.19.1",
"should": "^11.2.1",
"sinon": "^2.4.1",
"standard": "^10.0.3",
"@types/node": "^10.5.5",
"eslint": "^5.2.0",
"should": "^13.2.3",
"sinon": "^6.1.4",
"standard": "^11.0.1",
"typescript": "^2.9.2"
},
"typings": "typings/index.d.ts"
24 changes: 24 additions & 0 deletions test/test.command.helpInformation.js
Original file line number Diff line number Diff line change
@@ -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);
13 changes: 13 additions & 0 deletions test/test.noCommand.action.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
var program = require('../')
, should = require('should');

var val = false;
program
.option('-C, --no-color', 'turn off color output')
.action(function () {
val = this.color;
});

program.parse(['node', 'test']);

program.color.should.equal(val);