Current section
Files
Jump to
Current section
Files
src/gladvent.erl
-module(gladvent).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]).
-export([run/0]).
-file("/home/runner/work/gladvent/gladvent/src/gladvent.gleam", 43).
-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).
-file("/home/runner/work/gladvent/gladvent/src/gladvent.gleam", 14).
-spec run() -> nil.
run() ->
Commands = begin
_pipe = glint:new(),
_pipe@1 = glint:path_help(
_pipe,
[],
<<"gladvent is an advent of code runner and generator for gleam. Please use either the 'run' or 'new' commands."/utf8>>
),
_pipe@2 = glint:with_name(_pipe@1, <<"gladvent"/utf8>>),
_pipe@3 = glint:pretty_help(_pipe@2, glint:default_pretty_help()),
_pipe@4 = glint:group_flag(
_pipe@3,
[],
gladvent@internal@cmd:year_flag()
),
_pipe@5 = glint:add(
_pipe@4,
[<<"new"/utf8>>],
gladvent@internal@cmd@new:new_command()
),
_pipe@6 = glint:group_flag(
_pipe@5,
[<<"run"/utf8>>],
gladvent@internal@cmd@run:timeout_flag()
),
_pipe@7 = glint:group_flag(
_pipe@6,
[<<"run"/utf8>>],
gladvent@internal@cmd@run:allow_crash_flag()
),
_pipe@8 = glint:add(
_pipe@7,
[<<"run"/utf8>>],
gladvent@internal@cmd@run:run_command()
),
glint:add(
_pipe@8,
[<<"run"/utf8>>, <<"all"/utf8>>],
gladvent@internal@cmd@run:run_all_command()
)
end,
glint:run_and_handle(
Commands,
erlang:element(4, argv:load()),
fun(Out) -> case Out of
{ok, Out@1} ->
_pipe@9 = Out@1,
_pipe@10 = gleam@string:join(_pipe@9, <<"\n\n"/utf8>>),
gleam@io:println(_pipe@10);
{error, Err} ->
print_snag_and_halt(Err)
end end
).