commander 1.3.1 → 1.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/History.md +5 -0
- package/index.js +5 -2
- package/package.json +1 -1
package/History.md
CHANGED
package/index.js
CHANGED
|
@@ -91,6 +91,7 @@ Option.prototype.is = function(arg){
|
|
|
91
91
|
function Command(name) {
|
|
92
92
|
this.commands = [];
|
|
93
93
|
this.options = [];
|
|
94
|
+
this._execs = [];
|
|
94
95
|
this._args = [];
|
|
95
96
|
this._name = name;
|
|
96
97
|
}
|
|
@@ -155,6 +156,7 @@ Command.prototype.command = function(name, desc){
|
|
|
155
156
|
var cmd = new Command(args.shift());
|
|
156
157
|
if (desc) cmd.description(desc);
|
|
157
158
|
if (desc) this.executables = true;
|
|
159
|
+
if (desc) this._execs[cmd._name] = true;
|
|
158
160
|
this.commands.push(cmd);
|
|
159
161
|
cmd.parseExpectedArgs(args);
|
|
160
162
|
cmd.parent = this;
|
|
@@ -374,8 +376,9 @@ Command.prototype.parse = function(argv){
|
|
|
374
376
|
|
|
375
377
|
var result = this.parseArgs(this.args, parsed.unknown);
|
|
376
378
|
|
|
377
|
-
// executable sub-commands
|
|
378
|
-
|
|
379
|
+
// executable sub-commands
|
|
380
|
+
var name = result.args[0];
|
|
381
|
+
if (this._execs[name]) return this.executeSubCommand(argv, args, parsed.unknown);
|
|
379
382
|
|
|
380
383
|
return result;
|
|
381
384
|
};
|
package/package.json
CHANGED