rearrange template script

This commit is contained in:
Adam Millerchip 2022-11-28 01:20:58 +09:00
parent 8cd6e34a29
commit 01747af081
1 changed files with 13 additions and 9 deletions

View File

@ -7,19 +7,23 @@ defmodule DayREPLACE_ME do
:ok :ok
end end
def run do
case input() do
:usage -> print_usage()
input -> run_parts_with_timer(input)
end
end
def input do def input do
with [input_filename] <- System.argv(), with [input_filename] <- System.argv(),
{:ok, input} <- File.read(input_filename) do {:ok, input} <- File.read(input_filename) do
input input
else else
_ -> :usage _ -> :error
end
end
#######################
# HERE BE BOILERPLATE #
#######################
def run do
case input() do
:error -> print_usage()
input -> run_parts_with_timer(input)
end end
end end
@ -52,4 +56,4 @@ defmodule DayREPLACE_ME do
end end
end end
DayREPLACE_ME.run() # DayREPLACE_ME.run()