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 runners:build_from_days_dir() of
{ok, Runners} ->
execute(Runners);
{error, Err} ->
print_snag_and_halt(Err)
end.
-spec execute(
gleam@map:map_(integer(), {fun((binary()) -> gleam@dynamic:dynamic()),
fun((binary()) -> gleam@dynamic:dynamic())})
) -> nil.
execute(Runners) ->
Commands = begin
_pipe = glint:new(),
_pipe@1 = glint:with_pretty_help(
_pipe,
{pretty_help,
[<<"182"/utf8>>, <<"255"/utf8>>, <<"234"/utf8>>],
[<<"255"/utf8>>, <<"175"/utf8>>, <<"243"/utf8>>],
[<<"252"/utf8>>, <<"226"/utf8>>, <<"174"/utf8>>]}
),
_pipe@2 = glint:add_command_from_stub(_pipe@1, cmd@new:new_command()),
_pipe@3 = glint:add_command_from_stub(
_pipe@2,
cmd@run:run_command(Runners)
),
glint:add_command_from_stub(_pipe@3, cmd@run:run_all_command(Runners))
end,
case glint:execute(Commands, gleam@erlang:start_arguments()) of
{ok, {out, {ok, Output}}} ->
_pipe@4 = Output,
_pipe@5 = gleam@string:join(_pipe@4, <<"\n\n"/utf8>>),
gleam@io:println(_pipe@5);
{ok, {help, Help}} ->
gleam@io:println(Help);
{ok, {out, {error, Err}}} ->
print_snag_and_halt(Err);
{error, Err} ->
print_snag_and_halt(Err)
end.
-spec print_snag_and_halt(snag:snag()) -> nil.
print_snag_and_halt(Err) ->
_pipe = Err,
_pipe@1 = snag:pretty_print(_pipe),
gleam@io:println(_pipe@1),
erlang:halt(1).