-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.mjs
38 lines (32 loc) · 780 Bytes
/
index.mjs
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
import parser from "./statementsParserModule.mjs";
import { parseArgs } from "node:util";
const options = {
input: {
type: "string",
short: "i",
},
output: {
type: "string",
short: "o",
},
};
const { values, positionals } = parseArgs({ options, allowPositionals: true });
const argsCheckDict = {
"Source folder not defined": !("input" in values),
"Destination file not defined": !("output" in values),
};
const argsCheckResult = Object.keys(
Object.assign(
{},
...Object.entries(argsCheckDict)
.filter(([k, v]) => v)
.map(([k, v]) => ({ [k]: v }))
)
);
if (argsCheckResult.length) {
argsCheckResult.forEach((x) => {
console.log(x);
});
process.exit(1);
}
parser.statementsPDFtoXLSX(values.input, values.output);