date offset fix & post response detail echo
This commit is contained in:
+11
-5
@@ -14,10 +14,11 @@ defmodule Jump.CLI do
|
||||
end
|
||||
|
||||
defp fetch(args) do
|
||||
the_end = Calendar.strftime(DateTime.utc_now(), "%Y%m%d")
|
||||
{the_end_int, ""} = Integer.parse(the_end)
|
||||
format = &Calendar.strftime(&1, "%Y%m%d")
|
||||
|
||||
start = the_end_int - args[:days]
|
||||
now = DateTime.utc_now()
|
||||
the_end = format.(now)
|
||||
start = now |> DateTime.add(-4, :day) |> format.()
|
||||
|
||||
Jump.fetch(args[:article], start, the_end)
|
||||
end
|
||||
@@ -40,11 +41,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
|
||||
|
||||
Reference in New Issue
Block a user