From 8e7c6469d9eb23a9180a87b84d093aab4665eb98 Mon Sep 17 00:00:00 2001 From: kirinnee Date: Thu, 8 Aug 2024 20:58:12 +0800 Subject: [PATCH] fix: not converting cli input to JS objects --- src/cli/cli.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/cli/cli.ts b/src/cli/cli.ts index 1b2459d..ae5bfc6 100644 --- a/src/cli/cli.ts +++ b/src/cli/cli.ts @@ -118,9 +118,9 @@ class Cli { `Interval to poll in seconds, default 180`, ) .action( - async ({ data, interval }: { data: WatchData[]; interval: string }) => { + async ({ data, interval }: { data: string; interval: string }) => { await tracer.startActiveSpan("watch", async (span) => { - if (data == null) this.err("Data is required, -d []"); + if (data == null) this.err("Data is required, -d '[]'"); if (interval == null) this.err("Interval is required, -i "); @@ -128,9 +128,11 @@ class Cli { if (isNaN(i)) this.err("Interval must be a number"); + const dObj = JSON.parse(data); + this.logger.info({ jobData: dObj }, "Job data"); const all: Promise[] = []; - for (const { date, from } of data) { + for (const { date, from } of dObj) { const d = this.zincDate.from(date); if (from !== "JToW" && from !== "WToJ") this.err("From must be either 'JToW' or 'WToJ'");