-module(cactus). -compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]). -export([main/0]). -spec main() -> nil. main() -> Gleam_toml = cactus@util:toml_path(), Cmd = begin _pipe = shellout_ffi:start_arguments(), _pipe@1 = gleam@list:filter( _pipe, fun(A) -> not gleam@string:ends_with(A, <<".js"/utf8>>) end ), _pipe@2 = gleam@list:filter( _pipe@1, fun(A@1) -> not gleam@string:ends_with(A@1, <<".mjs"/utf8>>) end ), _pipe@3 = gleam@list:filter( _pipe@2, fun(A@2) -> not gleam@string:ends_with(A@2, <<".cjs"/utf8>>) end ), _pipe@4 = gleam@list:last(_pipe@3), gleam@result:unwrap(_pipe@4, <<""/utf8>>) end, Res = case Cmd of <<""/utf8>> -> cactus@write:init(Gleam_toml); <<"init"/utf8>> -> cactus@write:init(Gleam_toml); Arg -> case gleam@list:contains( [<<"applypatch-msg"/utf8>>, <<"commit-msg"/utf8>>, <<"fsmonitor-watchman"/utf8>>, <<"post-update"/utf8>>, <<"pre-applypatch"/utf8>>, <<"pre-commit"/utf8>>, <<"pre-merge-commit"/utf8>>, <<"prepare-commit-msg"/utf8>>, <<"pre-push"/utf8>>, <<"pre-rebase"/utf8>>, <<"pre-receive"/utf8>>, <<"push-to-checkout"/utf8>>, <<"update"/utf8>>], Arg ) of true -> _pipe@5 = cactus@run:run(Gleam_toml, Arg), gleam@result:replace(_pipe@5, nil); false -> gleam@io:println_error( <<<<"Invalid arg: '"/utf8, Arg/binary>>/binary, "'"/utf8>> ), shellout_ffi:os_exit(1), {error, nil} end end, case Res of {ok, _} -> nil; {error, _} -> gleam@io:println_error(<>), shellout_ffi:os_exit(1) end.