Current section
Files
Jump to
Current section
Files
src/gladvent.erl
-module(gladvent).
-compile(no_auto_import).
-export([main/0, execute/1]).
-spec main() -> nil.
main() ->
case cmd@run:build_runners_from_days_dir() of
{ok, Runners} ->
execute(Runners);
{error, Err} ->
_pipe = Err,
_pipe@1 = snag:pretty_print(_pipe),
gleam@io:println(_pipe@1),
erlang:halt(1)
end.
-spec execute(
gleam@map:map_(integer(), fun((binary()) -> {integer(), integer()}))
) -> nil.
execute(Runners) ->
Commands = begin
_pipe = glint:new(),
_pipe@1 = glint:add_command(
_pipe,
[],
fun(_) ->
gleam@io:println(
<<"\n\e[1;4mAvailable Commands\e[0m
\e[1;3mrun\e[0m: run the specified days
usage: gleam run run <dayX> <dayY> <...>
flags:
--timeout: run with specified timeout
type: Int > 0
usage: gleam run run --timeout=1000 <dayX> <dayY> <...>
--all: run all registered days
type: Bool
usage: gleam run run --all
\e[1;3mnew\e[0m: create .gleam and input files
usage: gleam run new <dayX> <dayY> <...>
"/utf8>>
)
end,
[]
),
_pipe@2 = cmd@run:register_command(_pipe@1, Runners),
cmd@new:register_command(_pipe@2)
end,
case glint:execute(Commands, gleam@erlang:start_arguments()) of
{ok, nil} ->
nil;
{error, Err} ->
_pipe@3 = [snag:pretty_print(Err),
<<"\n\e[1;4mAvailable Commands\e[0m
\e[1;3mrun\e[0m: run the specified days
usage: gleam run run <dayX> <dayY> <...>
flags:
--timeout: run with specified timeout
type: Int > 0
usage: gleam run run --timeout=1000 <dayX> <dayY> <...>
--all: run all registered days
type: Bool
usage: gleam run run --all
\e[1;3mnew\e[0m: create .gleam and input files
usage: gleam run new <dayX> <dayY> <...>
"/utf8>>],
_pipe@4 = gleam@string:join(_pipe@3, <<"\n"/utf8>>),
gleam@io:println(_pipe@4),
erlang:halt(1)
end.