Skip to content

Commit 1d845b5

Browse files
author
Fernando Campione
committed
fix paused @ syntax jobs
1 parent f455e88 commit 1d845b5

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

app/_utils/line-manipulation-utils.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -316,11 +316,19 @@ export const parseJobsFromLines = (
316316
const nextLine = lines[i + 1].trim();
317317
if (nextLine.startsWith("# ")) {
318318
const commentedCron = nextLine.substring(2);
319-
const parts = commentedCron.split(/\s+/);
320-
if (parts.length >= 6) {
321-
const schedule = parts.slice(0, 5).join(" ");
322-
const command = parts.slice(5).join(" ");
319+
const parts = commentedCron.split(/(?:\s|\t)+/);
320+
let schedule: string | undefined;
321+
let command: string | undefined;
322+
323+
if (parts[0].startsWith("@") && parts.length >= 2) {
324+
schedule = parts[0];
325+
command = commentedCron.slice(commentedCron.indexOf(parts[1]));
326+
} else if (parts.length >= 6) {
327+
schedule = parts.slice(0, 5).join(" ");
328+
command = commentedCron.slice(commentedCron.indexOf(parts[5]));
329+
}
323330

331+
if (schedule && command) {
324332
const jobId =
325333
uuid || generateStableJobId(schedule, command, user, comment, i);
326334

0 commit comments

Comments
 (0)