mirror of
https://github.com/jsdoc/jsdoc.git
synced 2025-12-08 19:46:11 +00:00
make several methods chainable
This commit is contained in:
parent
5a34187ed7
commit
53479c10e8
@ -50,6 +50,8 @@ ArgParser.prototype._addOption = function(option) {
|
||||
if (longName) {
|
||||
this._longNameIndex[longName] = currentIndex;
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -60,6 +62,7 @@ ArgParser.prototype._addOption = function(option) {
|
||||
* @param {string} helpText A brief description of the option.
|
||||
* @param {boolean} [canHaveMultiple=false] Set to `true` if the option can be provided more than once.
|
||||
* @param {function} [coercer] A function to coerce the given value to a specific type.
|
||||
* @return {this}
|
||||
* @example
|
||||
* myParser.addOption('t', 'template', true, 'The path to the template.');
|
||||
* myParser.addOption('h', 'help', false, 'Show the help message.');
|
||||
@ -74,7 +77,7 @@ ArgParser.prototype.addOption = function(shortName, longName, hasValue, helpText
|
||||
coercer: coercer
|
||||
};
|
||||
|
||||
this._addOption(option);
|
||||
return this._addOption(option);
|
||||
};
|
||||
|
||||
// TODO: refactor addOption to accept objects, then get rid of this method
|
||||
@ -95,7 +98,7 @@ ArgParser.prototype.addIgnoredOption = function(shortName, longName) {
|
||||
ignore: true
|
||||
};
|
||||
|
||||
this._addOption(option);
|
||||
return this._addOption(option);
|
||||
};
|
||||
|
||||
function padding(length) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user