diff --git a/src/commands.ts b/src/commands.ts index e12b4d2f..fa66b594 100644 --- a/src/commands.ts +++ b/src/commands.ts @@ -295,11 +295,11 @@ export function parseCommand(argv: string[]): CliCommand { if (argv[1] === "pause" || argv[1] === "resume" || argv[1] === "delete") { const target = parseIngestionTarget(argv[2] ?? ""); - if (!target || typeof target !== "string" || argv.length > 3) { + if (target !== "all" || argv.length > 3) { return { kind: "error", exitCode: 1, - message: `Usage: openwiki cron ${argv[1]} `, + message: `Usage: openwiki cron ${argv[1]} all`, }; } @@ -316,7 +316,7 @@ export function parseCommand(argv: string[]): CliCommand { kind: "error", exitCode: 1, message: - "Usage: openwiki cron list | pause | resume | delete ", + "Usage: openwiki cron list | pause all | resume all | delete all", }; } } @@ -580,9 +580,9 @@ export const helpContent: HelpContent = { "openwiki auth tools ", "openwiki ingest ", "openwiki cron list", - "openwiki cron pause ", - "openwiki cron resume ", - "openwiki cron delete ", + "openwiki cron pause all", + "openwiki cron resume all", + "openwiki cron delete all", "openwiki ngrok start [url] [--port ]", ], commands: [ @@ -625,17 +625,17 @@ export const helpContent: HelpContent = { description: "List saved connector schedules and local launchd status.", }, { - label: "openwiki cron pause ", + label: "openwiki cron pause all", description: "Pause saved connector schedules and reconcile the Mac wake window.", }, { - label: "openwiki cron resume ", + label: "openwiki cron resume all", description: "Resume paused connector schedules and reconcile the Mac wake window.", }, { - label: "openwiki cron delete ", + label: "openwiki cron delete all", description: "Delete saved connector schedules and remove stale local schedule files.", }, @@ -692,9 +692,9 @@ export const helpContent: HelpContent = { "openwiki ingest web-search", "openwiki ingest web-search-2", "openwiki cron list", - "openwiki cron pause web-search", - "openwiki cron resume web-search", - "openwiki cron delete web-search", + "openwiki cron pause all", + "openwiki cron resume all", + "openwiki cron delete all", "openwiki auth slack", "openwiki auth gmail", "openwiki auth notion", diff --git a/test/commands.test.ts b/test/commands.test.ts index 19a1fc53..4f307513 100644 --- a/test/commands.test.ts +++ b/test/commands.test.ts @@ -325,6 +325,11 @@ describe("parseCommand — cron", () => { expect(result.kind).toBe("error"); }); + test("cron pause with a source id is rejected", () => { + const result = parseCommand(["cron", "pause", "web-search"]); + expect(result.kind).toBe("error"); + }); + test("cron resume with a source instance id is rejected", () => { const result = parseCommand(["cron", "resume", "web-search-1"]); expect(result.kind).toBe("error");