forked from jsdoc/jsdoc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improved doc comments in some of the jsdoc modules.
- Loading branch information
Showing
9 changed files
with
84 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
/** | ||
Parse the command line arguments. | ||
@module common/args | ||
@author Michael Mathews <[email protected]> | ||
@license Apache License 2.0 - See file 'LICENSE.md' in this project. | ||
|
@@ -9,18 +10,18 @@ | |
Create an instance of the parser. | ||
@constructor | ||
*/ | ||
exports.Parser = function() { | ||
exports.ArgParser = function() { | ||
this._options = []; | ||
} | ||
|
||
exports.Parser.prototype._getOptionByShortName = function(name) { | ||
exports.ArgParser.prototype._getOptionByShortName = function(name) { | ||
for (var i = this._options.length; i--;) { | ||
if (this._options[i].shortName === name) { return this._options[i]; } | ||
} | ||
return null; | ||
} | ||
|
||
exports.Parser.prototype._getOptionByLongName = function(name) { | ||
exports.ArgParser.prototype._getOptionByLongName = function(name) { | ||
for (var i = this._options.length; i--;) { | ||
if (this._options[i].longName === name) { return this._options[i]; } | ||
} | ||
|
@@ -29,25 +30,23 @@ | |
|
||
/** | ||
* Provide information about a legal option. | ||
* @method Parser#addOption | ||
* @param shortName | ||
* @param longName | ||
* @param hasValue | ||
* @param helpText | ||
* @param {character} shortName | ||
* @param {string} longName | ||
* @param {boolean} hasValue | ||
* @param {string} helpText | ||
* @example | ||
* myParser.addOption('t', 'template', true, 'The path to the template.'); | ||
* myParser.addOption('h', 'help', false, 'Show the help message.'); | ||
*/ | ||
exports.Parser.prototype.addOption = function(shortName, longName, hasValue, helpText) { | ||
exports.ArgParser.prototype.addOption = function(shortName, longName, hasValue, helpText) { | ||
this._options.push({shortName: shortName, longName: longName, hasValue: hasValue, helpText: helpText}); | ||
}; | ||
|
||
/** | ||
Generate a summary of all the options with corresponding help text. | ||
@method Parser#help | ||
@returns {string} | ||
*/ | ||
exports.Parser.prototype.help = function() { | ||
exports.ArgParser.prototype.help = function() { | ||
var help = 'OPTIONS:\n', | ||
option; | ||
|
||
|
@@ -74,14 +73,13 @@ | |
|
||
/** | ||
Get the options. | ||
@method Parser#parse | ||
@param args An array, like ['-x', 'hello'] | ||
@param defaults An optional collection of default values. | ||
@param {Array.<string>} args An array, like ['-x', 'hello'] | ||
@param {Object} [defaults={}] An optional collection of default values. | ||
@returns {Object} The keys will be the longNames, or the shortName if | ||
no longName is defined for that option. The values will be the values | ||
provided, or `true` if the option accepts no value. | ||
*/ | ||
exports.Parser.prototype.parse = function(args, defaults) { | ||
exports.ArgParser.prototype.parse = function(args, defaults) { | ||
var result = defaults || {}; | ||
|
||
result._ = []; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,13 @@ | ||
/** | ||
Recursively print out all names and values in a data structure. | ||
@module common/dumper | ||
@author Michael Mathews <[email protected]> | ||
@license Apache License 2.0 - See file 'LICENSE.md' in this project. | ||
*/ | ||
(function() { | ||
/** | ||
@param {any} object | ||
*/ | ||
exports.dump = function(object) { | ||
indentBy = 0; | ||
output = ''; | ||
|
@@ -25,14 +29,23 @@ | |
return padding; | ||
} | ||
|
||
/** | ||
@param {string} openingBrace - The opening brace to add, like "{". | ||
@private | ||
@inner | ||
@memberof module:common/dumper | ||
*/ | ||
function indent(openingBrace) { | ||
indentBy++; | ||
if (openingBrace) output += openingBrace + '\n'; | ||
} | ||
|
||
/** | ||
@param {string|boolean} The closing brace to add, like "}" or if boolean | ||
`false` no closing brace nor trailing newline; | ||
@param {string|boolean} closingBrace - The closing brace to add, like "}" or if boolean | ||
`false` no closing brace or trailing newline. | ||
@private | ||
@inner | ||
@memberof module:common/dumper | ||
*/ | ||
function outdent(closingBrace) { | ||
indentBy--; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,12 @@ | ||
/** | ||
@module common/events | ||
@author Michael Mathews <[email protected]> | ||
@license Apache License 2.0 - See file 'LICENSE.md' in this project. | ||
*/ | ||
(function() { | ||
/** | ||
@mixin module:common/events | ||
Functions related to events. Designed to be mixed into other classes. | ||
@exports common/events | ||
@author Michael Mathews <[email protected]> | ||
@license Apache License 2.0 - See file 'LICENSE.md' in this project. | ||
*/ | ||
module.exports = { | ||
/** | ||
@function module:common/events.on | ||
@param {string} type | ||
@param {function} handler | ||
@returns this | ||
|
@@ -33,7 +30,6 @@ | |
}, | ||
|
||
/** | ||
@function module:common/events.fire | ||
@param {string} type | ||
@param {object} [eventData] | ||
@returns this | ||
|
@@ -54,7 +50,6 @@ | |
}, | ||
|
||
/** | ||
@function module:common/events.removeListener | ||
@param {string} type | ||
@param {function} handler | ||
*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
/** | ||
@overview File system stuff. | ||
@author Michael Mathews <[email protected]> | ||
Functions related to interaction with the filesystem. | ||
@module common/fs | ||
@author Michael Mathews <[email protected]> | ||
@license Apache License 2.0 - See file 'LICENSE.md' in this project. | ||
*/ | ||
|
||
|
@@ -9,6 +10,12 @@ | |
File = java.io.File, | ||
defaultEncoding = java.lang.System.getProperty('file.encoding'); | ||
|
||
/** | ||
Read the contents of a file. | ||
@param {string} path | ||
@param {string} encoding | ||
@returns {string} The contents of the file. | ||
*/ | ||
exports.read = function(path, encoding) { | ||
var options = options || {}, | ||
encoding = encoding || defaultEncoding, | ||
|
@@ -22,6 +29,12 @@ | |
return String( input.next() ); | ||
} | ||
|
||
/** | ||
Write the content to a file. | ||
@param {string} path | ||
@param {string} content | ||
@param {string} encoding | ||
*/ | ||
exports.write = function(path, content, encoding) { | ||
var options = options || {}, | ||
encoding = encoding || defaultEncoding, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,8 @@ | |
A collection of functions relating to JSDoc symbol name manipulation. | ||
@module jsdoc/name | ||
@requires jsdoc/tag/dictionary | ||
@author Michael Mathews <[email protected]> | ||
@license Apache License 2.0 - See file 'LICENSE.md' in this project. | ||
*/ | ||
(function() { | ||
var jsdoc = { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters