2017-06-05 5 views
0
/** 
* 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()); 
}; 

私はこれを試しましたが、htmlページにはlib/helpと空白のページしか表示されません。また、モジュールがどのようなものをエクスポートするかについて、@exportsを使いたいと思っていました。また、JSDocでオブジェクトの目的と概要を文書化する方法もあります。jsdocを使用してモジュール内の関数をドキュメント化する方法は?

答えて

0

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()); 
    }; 

また

@fileタグJSDocの中でオブジェクトの目的と概要を文書化する方法がある...あなたのfunction宣言の前でなければなりませんファイルの説明を提供します。ファイルの先頭にJSDocコメント内のタグを使用します。

JSDocをもう少し詳しくお読みください。

関連する問題