-module(gladvent). -compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]). -export([main/0]). -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). -spec main() -> nil. main() -> 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:as_module(_pipe@2), _pipe@4 = glint:group_flag( _pipe@3, [], gladvent@internal@cmd:year_flag() ), _pipe@5 = glint:pretty_help(_pipe@4, glint:default_pretty_help()), _pipe@6 = glint:add( _pipe@5, [<<"new"/utf8>>], gladvent@internal@cmd@new:new_command() ), _pipe@7 = glint:group_flag( _pipe@6, [<<"run"/utf8>>], gladvent@internal@cmd@run:timeout_flag() ), _pipe@8 = glint:group_flag( _pipe@7, [<<"run"/utf8>>], gladvent@internal@cmd@run:allow_crash_flag() ), _pipe@9 = glint:add( _pipe@8, [<<"run"/utf8>>], gladvent@internal@cmd@run:run_command() ), glint:add( _pipe@9, [<<"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@10 = Out@1, _pipe@11 = gleam@string:join(_pipe@10, <<"\n\n"/utf8>>), gleam@io:println(_pipe@11); {error, Err} -> print_snag_and_halt(Err) end end ).