aboutsummaryrefslogtreecommitdiff
path: root/deno/tools/manage-service.ts
diff options
context:
space:
mode:
Diffstat (limited to 'deno/tools/manage-service.ts')
-rw-r--r--deno/tools/manage-service.ts42
1 files changed, 42 insertions, 0 deletions
diff --git a/deno/tools/manage-service.ts b/deno/tools/manage-service.ts
new file mode 100644
index 0000000..148f55a
--- /dev/null
+++ b/deno/tools/manage-service.ts
@@ -0,0 +1,42 @@
+import { join } from "@std/path";
+// @ts-types="npm:@types/yargs"
+import yargs from "yargs";
+
+import { TemplateDir } from "./template.ts";
+
+if (import.meta.main) {
+ await yargs(Deno.args)
+ .scriptName("manage-service")
+ .option("project-dir", {
+ type: "string",
+ })
+ .demandOption("project-dir")
+ .command({
+ command: "gen-tmpl",
+ describe: "generate files for templates",
+ builder: (builder) => {
+ return builder
+ .option("dry-run", {
+ type: "boolean",
+ default: true,
+ })
+ .strict();
+ },
+ handler: (argv) => {
+ const { projectDir, dryRun } = argv;
+ new TemplateDir(
+ join(projectDir, "services/templates"),
+ ).generateWithVariableFiles(
+ [
+ join(projectDir, "data/config"),
+ join(projectDir, "services/config.template"),
+ ],
+ dryRun ? undefined : join(projectDir, "services/generated"),
+ );
+ },
+ })
+ .demandCommand(1, "One command must be specified.")
+ .help()
+ .strict()
+ .parse();
+}