fix(cli): clarify remaining required options

This commit is contained in:
Vincent Koc
2026-05-09 09:22:04 +08:00
parent 737d5253e5
commit e45b9d7a74
11 changed files with 40 additions and 15 deletions

View File

@@ -232,7 +232,7 @@ export function registerCronAddCommand(cron: Command) {
const name = normalizeOptionalString(opts.name) ?? "";
if (!name) {
throw new Error("--name is required");
throw new Error("Cron job name is required. Pass --name <name>.");
}
const description = normalizeOptionalString(opts.description);

View File

@@ -104,14 +104,14 @@ function resolveDirectSchedule(options: NormalizedScheduleOptions): CronSchedule
if (options.at) {
const atIso = parseAt(options.at, options.tz);
if (!atIso) {
throw new Error("Invalid --at; use ISO time or duration like 20m");
throw new Error("Invalid --at. Use an ISO timestamp or a duration like 20m.");
}
return { kind: "at", at: atIso };
}
if (options.every) {
const everyMs = parseDurationMs(options.every);
if (!everyMs) {
throw new Error("Invalid --every; use e.g. 10m, 1h, 1d");
throw new Error("Invalid --every. Use a duration like 10m, 1h, or 1d.");
}
return { kind: "every", everyMs };
}