Skip to content
This repository was archived by the owner on May 12, 2025. It is now read-only.

Commit b4b2fb2

Browse files
committed
update cli
1 parent 81ef83c commit b4b2fb2

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

bin/index.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,20 @@
11
#!/usr/bin/env node
2+
const path = require('path');
23
const fs = require('fs');
34
const parseComments = require('./../dist/openapi-comment-parser');
45

5-
const outputPath = process.argv[2];
6+
if (process.argv[2] === undefined || process.argv[3] === undefined) {
7+
console.log('Usage:');
8+
console.log(' openapi-comment-parser SRC_PATH OUTPUT');
9+
console.log();
10+
console.log('Example:');
11+
console.log(' openapi-comment-parser . openapi.json');
12+
return;
13+
}
614

7-
const spec = parseComments({ cwd: process.cwd() });
15+
const inputPath = path.resolve(process.argv[2]);
16+
const outputPath = path.resolve(process.argv[3]);
17+
18+
const spec = parseComments({ cwd: inputPath });
819

920
fs.writeFileSync(outputPath, JSON.stringify(spec));

0 commit comments

Comments
 (0)