Current section

Files

Jump to
gladvent src gladvent.erl
Raw

src/gladvent.erl

-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:with_name(_pipe, <<"gladvent"/utf8>>),
_pipe@2 = glint:as_gleam_module(_pipe@1),
_pipe@3 = glint:global_flag(
_pipe@2,
<<"year"/utf8>>,
gladvent@internal@cmd:year_flag()
),
_pipe@4 = glint:with_pretty_help(_pipe@3, glint:default_pretty_help()),
_pipe@5 = glint:add(
_pipe@4,
[<<"new"/utf8>>],
gladvent@internal@cmd@new:new_command()
),
_pipe@6 = glint:add(
_pipe@5,
[<<"run"/utf8>>],
gladvent@internal@cmd@run:run_command()
),
glint:add(
_pipe@6,
[<<"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@7 = Out@1,
_pipe@8 = gleam@string:join(_pipe@7, <<"\n\n"/utf8>>),
gleam@io:println(_pipe@8);
{error, Err} ->
print_snag_and_halt(Err)
end end
).