-module(go_over@hook). -compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]). -export([main/0]). -file("/home/bwireman/src/go-over/src/go_over/hook.gleam", 15). -spec get_path() -> binary(). get_path() -> _pipe = simplifile:current_directory(), _pipe@1 = go_over@util@util:hard_fail( _pipe, <<"could not get current path"/utf8>> ), _pipe@2 = filepath:join(_pipe@1, <<".git"/utf8>>), filepath:join(_pipe@2, <<"hooks"/utf8>>). -file("/home/bwireman/src/go-over/src/go_over/hook.gleam", 22). -spec main() -> {ok, nil} | {error, simplifile:file_error()}. main() -> _pipe = go_over@util@print:format_high( <<"This command is DEPRECATED consider using 🌵 cactus instead\nhttps://hex.pm/packages/cactus"/utf8>> ), gleam@io:println_error(_pipe), Pwd = get_path(), _pipe@1 = simplifile:create_directory_all(Pwd), go_over@util@util:hard_fail( _pipe@1, <<"could not create hooks directory"/utf8>> ), Pre_commit_path = filepath:join(Pwd, <<"pre-commit"/utf8>>), go_over@util@util:throwaway( go_over@util@util:has_flag( shellout_ffi:start_arguments(), <<"recreate"/utf8>> ), go_over@util@util:freeze1(fun simplifile_erl:delete/1, Pre_commit_path) ), _ = simplifile:create_file(Pre_commit_path), All = gleam@set:from_list([read, write, execute]), _ = simplifile:set_permissions( Pre_commit_path, {file_permissions, All, All, All} ), Text = case go_over@util@util:has_flag( shellout_ffi:start_arguments(), <<"outdated"/utf8>> ) of false -> <<"gleam run -m go_over --target erlang"/utf8>>; true -> <<"gleam run -m go_over --target erlang"/utf8, " -- --outdated"/utf8>> end, simplifile:append(Pre_commit_path, <<"\n"/utf8, Text/binary>>).