Skip to content
Myr

Support setting name in #name function and make it chainable

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

Similar to #description, #name now behaves like a setter when given an argument, and like a setter otherwise.

authored by Cedric Reichenbach · committed by Roman Vanesyan · parent add00ad · Browse files · 2 files+22 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

2 files+22 added−4 removed

  • tests:+16 added−0 removed
  • other:+6 added−4 removed

2 files+22 added−4 removed

added:test/test.command.name.set.js+16 added
modified:index.js+6 added-4 removed
896 unmodified lines
897 return this;898};899900/**901 * Get the name of the command901 * Get or set the name of the command902 *903 * @param {String} name903 * @param {String} str904 * @return {String|Command}905 * @api public906 */907908Command.prototype.name = function() {909 return this._name;908Command.prototype.name = function(str) {909 if (0 === arguments.length) return this._name;910 this._name = str;911 return this;912};913914/**915 * Return the largest option length.
216 unmodified lines