Skip to content
Myr

Merge pull request #296 from zhiyelee/small-refactor

Before adoption: this commit came in with the history the project adopted, so no landing records it.

merge the three `if(desc)`

authored by Zhiye Li · committed by Zhiye Li · parents 1a065da, fe3f70c · Browse files · 1 file+10 added−4 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+10 added−4 removed

  • other:+10 added−4 removed

1 file+10 added−4 removed

modified:index.js+10 added-4 removed
146 unmodified lines
147 *148 * program.parse(process.argv);149 *150 * @param {String} name151 * @param {String} [desc]151 * @param {String} [desc] for git-style sub-commands152 * @return {Command} the new command153 * @api public154 */155156Command.prototype.command = function(name, desc) {157 var args = name.split(/ +/);158 var cmd = new Command(args.shift());159160 if (desc) {159 if (desc) cmd.description(desc);160 if (desc) this.executables = true;161 if (desc) this._execs[cmd._name] = true;161 cmd.description(desc);162 this.executables = true;163 this._execs[cmd._name] = true;164165 }166167 this.commands.push(cmd);168 cmd.parseExpectedArgs(args);169 cmd.parent = this;170171 if (desc) return this;172 return cmd;173};174
815 unmodified lines