advent_of_code/lib/get_input.ex

13 lines
261 B
Elixir

defmodule Mix.Tasks.GetInput do
def run(args) do
[year, day] = args
write_file = &File.write("./input/#{year}_#{day}.txt", &1)
AoC.Input.fetch_input!(year, day)
|> then(fn i ->
IO.puts(i)
i
end)
|> write_file.()
end
end