Skip to content

Commit e8a4d53

Browse files
committed
CLI: Expose tsd-jsdoc's comments option to pbts as --no-comments, see #587
1 parent 6fe0992 commit e8a4d53

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,8 @@ Generates TypeScript definitions from annotated JavaScript files.
395395
396396
-o, --out Saves to a file instead of writing to stdout.
397397
398+
--no-comments Does not output any JSDoc comments.
399+
398400
usage: pbts [options] file1.js file2.js ...
399401
```
400402

cli/pbts.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,11 @@ exports.main = function(args, callback) {
2424
name: "n",
2525
out : "o"
2626
},
27-
string: [ "name", "out" ]
27+
string: [ "name", "out" ],
28+
boolean: [ "comments" ],
29+
default: {
30+
comments: true
31+
}
2832
});
2933

3034
var files = argv._;
@@ -42,6 +46,8 @@ exports.main = function(args, callback) {
4246
"",
4347
" -o, --out Saves to a file instead of writing to stdout.",
4448
"",
49+
" --no-comments Does not output any JSDoc comments.",
50+
"",
4551
"usage: " + chalk.bold.green("pbts") + " [options] file1.js file2.js ..."
4652
].join("\n"));
4753
if (callback)
@@ -62,7 +68,7 @@ exports.main = function(args, callback) {
6268
// There is no proper API for jsdoc, so this executes the CLI and pipes the output
6369
var basedir = path.join(__dirname, "..");
6470
var moduleName = argv.name || "null";
65-
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(' '), {
71+
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(' '), {
6672
cwd: process.cwd(),
6773
argv0: "node",
6874
stdio: "pipe",

0 commit comments

Comments
 (0)