-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.ts
45 lines (43 loc) · 1.22 KB
/
app.ts
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
42
43
44
45
import { parse } from "https://deno.land/[email protected]/flags/mod.ts";
import { usage } from "./lib/program/usage.ts";
import { splitApiDoc } from "./lib/commands/split.ts";
import { generateDevDocs } from "./lib/commands/provider-dev.ts";
import { buildDocs } from "./lib/commands/provider-build.ts";
import { formatApiSpec } from "./lib/commands/format-spec.ts";
import {
parseSplitArgs,
parseDevArgs,
parseBuildArgs,
parseFormatArgs,
} from "./lib/program/args.ts";
const args = parse(Deno.args);
const command = args._[0];
switch (command) {
case "split": {
const splitArgs = parseSplitArgs(args);
splitArgs ? await splitApiDoc(splitArgs) : null;
break;
}
case "dev": {
const devArgs = parseDevArgs(args);
devArgs ? await generateDevDocs(devArgs) : null;
break;
}
case "build": {
const buildArgs = parseBuildArgs(args);
buildArgs ? await buildDocs(buildArgs) : null;
break;
}
case "format": {
const formatArgs = parseFormatArgs(args);
formatArgs ? await formatApiSpec(formatArgs) : null;
break;
}
case "help": {
console.log(`${usage.program}`);
break;
}
default:
console.log(`${usage.program}`);
break;
}