From e8a4d5373b1a00cc6eafa5b201b91d0e250cc00b Mon Sep 17 00:00:00 2001 From: dcodeIO Date: Tue, 27 Dec 2016 23:17:35 +0100 Subject: [PATCH] CLI: Expose tsd-jsdoc's comments option to pbts as --no-comments, see #587 --- README.md | 2 ++ cli/pbts.js | 10 ++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 69a1e07e8..3ad70bcad 100644 --- a/README.md +++ b/README.md @@ -395,6 +395,8 @@ Generates TypeScript definitions from annotated JavaScript files. -o, --out Saves to a file instead of writing to stdout. + --no-comments Does not output any JSDoc comments. + usage: pbts [options] file1.js file2.js ... ``` diff --git a/cli/pbts.js b/cli/pbts.js index 2d5374385..ccb0f4fc8 100644 --- a/cli/pbts.js +++ b/cli/pbts.js @@ -24,7 +24,11 @@ exports.main = function(args, callback) { name: "n", out : "o" }, - string: [ "name", "out" ] + string: [ "name", "out" ], + boolean: [ "comments" ], + default: { + comments: true + } }); var files = argv._; @@ -42,6 +46,8 @@ exports.main = function(args, callback) { "", " -o, --out Saves to a file instead of writing to stdout.", "", + " --no-comments Does not output any JSDoc comments.", + "", "usage: " + chalk.bold.green("pbts") + " [options] file1.js file2.js ..." ].join("\n")); if (callback) @@ -62,7 +68,7 @@ exports.main = function(args, callback) { // There is no proper API for jsdoc, so this executes the CLI and pipes the output var basedir = path.join(__dirname, ".."); var moduleName = argv.name || "null"; - var child = child_process.exec("node \"" + basedir + "/node_modules/jsdoc/jsdoc.js\" -c \"" + basedir + "/jsdoc.types.json\" -q \"module=" + encodeURIComponent(moduleName) + "\" " + files.map(function(file) { return '"' + file + '"'; }).join(' '), { + var child = child_process.exec("node \"" + basedir + "/node_modules/jsdoc/jsdoc.js\" -c \"" + basedir + "/jsdoc.types.json\" -q \"module=" + encodeURIComponent(moduleName) + "&comments=" + Boolean(argv.comments) + "\" " + files.map(function(file) { return '"' + file + '"'; }).join(' '), { cwd: process.cwd(), argv0: "node", stdio: "pipe",