From c9bd5207b02b0d1b1d30ef02b29c6b5db9c04a30 Mon Sep 17 00:00:00 2001 From: thread Date: Wed, 15 Apr 2026 21:06:08 -0400 Subject: [PATCH] date offset fix & post response detail echo --- lib/cli.ex | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/lib/cli.ex b/lib/cli.ex index a18802c..9011887 100644 --- a/lib/cli.ex +++ b/lib/cli.ex @@ -14,12 +14,15 @@ defmodule Jump.CLI do end defp fetch(args) do - the_end = Calendar.strftime(DateTime.utc_now(), "%Y%m%d") + format = &Calendar.strftime(&1, "%Y%m%d") + + now = DateTime.utc_now() + the_end = format.(now) {the_end_int, ""} = Integer.parse(the_end) - start = the_end_int - args[:days] + start = now |> DateTime.add(-4, :day) |> format.() - Jump.fetch(args[:article], start, the_end) + Jump.fetch(args[:article], start, the_end_int) end defp calculate(items, args) do @@ -40,11 +43,16 @@ defmodule Jump.CLI do end defp finish(summary) do - Jump.post(summary) + %{status: status, body: %{"data" => data}} = Jump.post(summary) + IO.puts("Summary:") IO.inspect(summary) + IO.puts(""" + \nPost Response (Status #{status}): + #{inspect(data)} + """) + IO.puts("done.") end - end