forked from dineshsonachalam/markdown-autodocs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
41 lines (37 loc) · 1.25 KB
/
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
38
39
40
41
#!/usr/bin/env node
/**
* Entry point for markdown-autodocs CLI app
* Author: Dinesh Sonachalam
*/
import {app} from "./utils/app.js";
import pkg from "log4js";
const { getLogger } = pkg;
import {Command} from "commander/esm.mjs";
export const gitCliargs = function() {
const program = new Command();
program
.option("-o, --outputFilePath <outputFilePaths...>", "Output file paths")
.option("-c, --category <categories...>", "code-block, json-to-html-table, workflow-artifact-table")
.option("-r, --repo <type>", "Repo name")
.option("-b, --branch <type>", "Branch name")
.option("-a, --accessToken <type>", "Github Access token");
program.parse(process.argv);
return program.opts();
}
export const main = async function() {
const logger = getLogger();
logger.level = "info";
const options = gitCliargs();
const outputFilePaths = options.outputFilePath;
const categories = options.category;
const repo = options.repo;
const branch = options.branch;
const accessToken = options.accessToken;
for (const outputFilePath of outputFilePaths){
for (const category of categories){
const message = await app(outputFilePath, category, repo, branch, accessToken);
logger.info(message);
}
}
}
await main();