Skip to content

Commit

Permalink
Fix tj#256: automatically call addImplicitHelpCommand for sub-commands
Browse files Browse the repository at this point in the history
Move the setting of executables to true from the command method’s handling
of its undocumented desc parameter to the description method.
  • Loading branch information
rrthomas committed Mar 16, 2018
1 parent d8404f8 commit 9093fe7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,8 @@ Command.prototype.command = function(name, desc, opts) {
var cmd = new Command(args.shift());

if (desc) {
cmd.description(desc);
this.executables = true;
cmd.description(desc);
this._execs[cmd._name] = true;
if (opts.isDefault) this.defaultExecutable = cmd._name;
}
Expand Down Expand Up @@ -876,6 +876,7 @@ Command.prototype.version = function(str, flags) {

Command.prototype.description = function(str, argsDescription) {
if (arguments.length === 0) return this._description;
this.executables = true;
this._description = str;
this._argsDescription = argsDescription;
return this;
Expand Down

0 comments on commit 9093fe7

Please sign in to comment.