forked from postman-open-technologies/openapi-componentizer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
executable file
·37 lines (28 loc) · 871 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/env node
require("util").inspect.defaultOptions.depth = null;
const { program } = require("commander");
const figlet = require("figlet");
const { getDocument } = require("./document.js");
const { findType } = require("./find.js");
program
.requiredOption("-u, --url <value>")
.requiredOption("-t,--type <value>")
.option("--no-resolve")
.parse(process.argv);
const options = program.opts();
console.log(figlet.textSync("Type Finder"));
console.log("Url:" + options.url);
console.log("Type:" + options.type);
async function main(url, type) {
document = await getDocument(url, options.resolve);
list = findType(document, type);
if (list.length == 0) {
console.log(`No ${type} in the document.`);
}
list.forEach((element) => {
console.log(element);
console.log();
console.log();
});
}
main(options.url, options.type);