Documentation 如何使用jsdoc记录模块内的函数?
我试过了,但是html页面只显示lib/help,然后是空白页面。我还想使用@exports来说明模块导出的内容。还有一种方法可以在JSDoc中记录对象的用途和概述。JSDoc注释块应该在声明之前Documentation 如何使用jsdoc记录模块内的函数?,documentation,jsdoc,jsdoc3,Documentation,Jsdoc,Jsdoc3,我试过了,但是html页面只显示lib/help,然后是空白页面。我还想使用@exports来说明模块导出的内容。还有一种方法可以在JSDoc中记录对象的用途和概述。JSDoc注释块应该在声明之前 /** * Displays the list of autolab commands along with their functions. * @module lib/help */ var Table = require('cli-table'); var chalk = require('ch
/**
* Displays the list of autolab commands along with their functions.
* @module lib/help
*/
var Table = require('cli-table');
var chalk = require('chalk');
var helpjson = {
'init' : 'Initializes local repository and authenticates',
'exit' : 'Wipes off the credentials from the system',
'git create' : 'Creates a repository on Gitlab',
'git delete' : 'Deletes the specified repository from Gitlab',
'git changeserver' : 'To change the host of Gitlab',
'git changelang' : 'To change the language of the code submission',
'git push' : 'Adds, commits, pushes the code',
'submit' : 'To submit the code to JavaAutolab and fetch the results',
'help' : 'Print help manual'
};
module.exports = function() {
/**
* Displays the list of autolab commands along with their functions.
* @function
* @param {null}
*/
console.log('\n' + chalk.blue('Usage:') + ' autolab [OPTIONS]');
var table = new Table({
head: ['Options:', ''],
colWidths: [20,70]
});
for (var key in helpjson)
table.push(
[key,helpjson[key]]
);
console.log(table.toString());
};
还有一种方法可以在JSDoc中记录对象的用途和概述吗
标记提供文件的说明。在文件开头的JSDoc注释中使用标记
通过阅读更多的文档来熟悉
/**
* Displays the list of autolab commands along with their functions.
* @module lib/help
*/
var Table = require('cli-table');
var chalk = require('chalk');
var helpjson = {
'init': 'Initializes local repository and authenticates',
'exit': 'Wipes off the credentials from the system',
'git create': 'Creates a repository on Gitlab',
'git delete': 'Deletes the specified repository from Gitlab',
'git changeserver': 'To change the host of Gitlab',
'git changelang': 'To change the language of the code submission',
'git push': 'Adds, commits, pushes the code',
'submit': 'To submit the code to JavaAutolab and fetch the results',
'help': 'Print help manual'
};
/**
* Displays the list of autolab commands along with their functions.
* @function
* @param {null}
*/
module.exports = function () {
console.log('\n' + chalk.blue('Usage:') + ' autolab [OPTIONS]');
var table = new Table({
head: ['Options:', ''],
colWidths: [20, 70]
});
for (var key in helpjson)
table.push(
[key, helpjson[key]]
);
console.log(table.toString());
};