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: v3.0.1
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: v3.0.2
Choose a head ref
  • 1 commit
  • 4 files changed
  • 1 contributor

Commits on Sep 26, 2019

  1. Improve executable subcommand tracking (#1056)

    * Track executables better
    
    * Bump version for release
    
    * Update dependencies
    shadowspawn authored Sep 26, 2019

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    2544df8 View commit details
Showing with 203 additions and 146 deletions.
  1. +10 −0 CHANGELOG.md
  2. +3 −3 index.js
  3. +184 −137 package-lock.json
  4. +6 −6 package.json
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -5,6 +5,16 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). (Format adopted after v3.0.0.)

## [3.0.2] (2019-09-27)

### Fixed

* Improve tracking of executable subcommands.

### Changed

* update development dependencies

## [3.0.1] (2019-08-30)

### Added
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
@@ -97,7 +97,7 @@ Option.prototype.is = function(arg) {
function Command(name) {
this.commands = [];
this.options = [];
this._execs = {};
this._execs = new Set();
this._allowUnknownOption = false;
this._args = [];
this._name = name || '';
@@ -149,7 +149,7 @@ Command.prototype.command = function(nameAndArgs, actionOptsOrExecDesc, execOpts
if (desc) {
cmd.description(desc);
this.executables = true;
this._execs[cmd._name] = true;
this._execs.add(cmd._name);
if (opts.isDefault) this.defaultExecutable = cmd._name;
}
cmd._noHelp = !!opts.noHelp;
@@ -498,7 +498,7 @@ Command.prototype.parse = function(argv) {
});
}

if (this._execs[name] && typeof this._execs[name] !== 'function') {
if (this._execs.has(name)) {
return this.executeSubCommand(argv, args, parsed.unknown, subCommand ? subCommand._executableFile : undefined);
}

Loading