blob: 93f4c1bd765f84d060e872918f83c2b85bad90b6 (
plain)
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
|
import { parseArgs } from "@std/cli";
import { loadVariables, TemplateDir } from "./template.ts";
import { join } from "@std/path";
if (import.meta.main) {
const args = parseArgs(Deno.args, {
string: ["project-dir"],
boolean: ["no-dry-run"],
});
if (args._.length === 0) {
throw new Error("You must specify a command.");
}
const projectDir = args["project-dir"];
if (projectDir == null) {
throw new Error("You must specify project-dir.");
}
const command = String(args._[0]);
switch (command) {
case "gen-tmpl":
new TemplateDir(
join(projectDir, "services/templates"),
).generateWithVariableFiles(
[
join(projectDir, "data/config"),
join(projectDir, "services/config.template"),
],
args["no-dry-run"] === true
? join(projectDir, "services/generated")
: undefined,
);
break;
default:
throw new Error(command + " is not a valid command.");
}
}
|