diff --git a/tools/hwlab-cli/bin/hwlab-cli.ts b/tools/hwlab-cli/bin/hwlab-cli.ts index fbbcec26..f707ad94 100644 --- a/tools/hwlab-cli/bin/hwlab-cli.ts +++ b/tools/hwlab-cli/bin/hwlab-cli.ts @@ -17,9 +17,9 @@ if (argv[0] === "tasktree") { } else if (argv[0] === "caserun") { const { caserunNativeServiceCommand, caserunNativeServicesCommand } = await import("../../src/caserun-native-service.ts"); try { - const result = ["start", "stop", "restart", "status", "logs"].includes(argv[2] ?? "") && argv[3] === undefined + const result = argv[1] === "service" && ["start", "stop", "restart", "status", "logs"].includes(argv[2] ?? "") && argv[3] === undefined ? await caserunNativeServicesCommand({ action: argv[2], cwd: process.cwd(), env: process.env }) - : await caserunNativeServiceCommand({ service: argv[2] ?? "", action: argv[3] ?? "status", cwd: process.cwd(), env: process.env }); + : await caserunNativeServiceCommand({ service: argv[1] === "service" ? argv[2] ?? "" : "", action: argv[1] === "service" ? argv[3] ?? "status" : "status", cwd: process.cwd(), env: process.env }); console.log(JSON.stringify(result, null, 2)); process.exitCode = result?.ok === false ? 1 : 0; } catch (error: any) {