32 lines
1.5 KiB
TypeScript
32 lines
1.5 KiB
TypeScript
#!/usr/bin/env bun
|
|
import { main } from "../../src/hwlab-cli-lib.ts";
|
|
|
|
const argv = process.argv.slice(2);
|
|
if (argv[0] === "tasktree") {
|
|
const { runTaskTreeCli } = await import("../../src/tasktree-cli.ts");
|
|
try {
|
|
const result = await runTaskTreeCli(argv.slice(1));
|
|
console.log(JSON.stringify(result, null, 2));
|
|
process.exitCode = result?.ok === false ? 1 : 0;
|
|
} catch (error) {
|
|
console.log(JSON.stringify({ ok: false, operation: "tasktree", error: { code: (error as any)?.code ?? "tasktree_cli_error", message: (error as any)?.message ?? String(error) } }, null, 2));
|
|
process.exitCode = 1;
|
|
}
|
|
} else if (argv[0] === "workbench") {
|
|
const { runWorkbenchCli } = await import("../../src/workbench-cli.ts");
|
|
try {
|
|
const result = await runWorkbenchCli(argv.slice(1));
|
|
console.log(JSON.stringify(result, null, 2));
|
|
process.exitCode = result?.ok === false ? 1 : 0;
|
|
} catch (error: any) {
|
|
console.log(JSON.stringify({ ok: false, operation: "workbench", error: { code: error?.code ?? "workbench_cli_error", message: error?.message ?? String(error) } }, null, 2));
|
|
process.exitCode = 1;
|
|
}
|
|
} else if (argv[0] === "kafka") {
|
|
const { mainKafkaCli } = await import("../../src/hwlab-cli/kafka-regenerate.ts");
|
|
await mainKafkaCli(argv.slice(1));
|
|
} else if (argv[0] === "case" && argv[1] === "audit") {
|
|
const { mainCaseRunAuditCli } = await import("../../src/hwlab-caserun-audit.ts");
|
|
await mainCaseRunAuditCli(argv.slice(2));
|
|
} else await main(argv);
|