Files
cronmaster/app/_utils/wrapper-utils-client.ts
2025-11-10 11:41:04 +00:00

31 lines
705 B
TypeScript

export const unwrapCommand = (command: string): string => {
const wrapperPattern = /^(.+\/cron-log-wrapper\.sh)\s+"([^"]+)"\s+(.+)$/;
const match = command.match(wrapperPattern);
if (match && match[3]) {
return match[3];
}
return command;
};
export const isCommandWrapped = (command: string): boolean => {
const wrapperPattern = /\/cron-log-wrapper\.sh\s+"[^"]+"\s+/;
return wrapperPattern.test(command);
};
export const extractJobIdFromWrappedCommand = (
command: string
): string | null => {
const wrapperPattern = /\/cron-log-wrapper\.sh\s+"([^"]+)"\s+/;
const match = command.match(wrapperPattern);
if (match && match[1]) {
return match[1];
}
return null;
};