-module(go_over@util@util). -compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]). -export([iff/3, iff_nil/2, throwaway/2, hard_fail/2, has_flag/2, retry_cmd/2, freeze1/2, freeze2/3]). -file("/home/bwireman/src/go-over/src/go_over/util/util.gleam", 6). -spec iff(boolean(), fun(() -> SMM), SMM) -> SMM. iff(V, F, Default) -> case V of true -> F(); _ -> Default end. -file("/home/bwireman/src/go-over/src/go_over/util/util.gleam", 14). -spec iff_nil(boolean(), fun(() -> nil)) -> nil. iff_nil(V, F) -> iff(V, F, nil). -file("/home/bwireman/src/go-over/src/go_over/util/util.gleam", 18). -spec throwaway(boolean(), fun(() -> {ok, any()} | {error, any()})) -> nil. throwaway(V, F) -> case V of true -> _ = F(), nil; _ -> nil end. -file("/home/bwireman/src/go-over/src/go_over/util/util.gleam", 28). -spec hard_fail({ok, SMR} | {error, any()}, binary()) -> SMR. hard_fail(Res, Msg) -> case Res of {ok, Val} -> Val; _ -> go_over@util@print:warning(<<"Error: "/utf8, Msg/binary>>), shellout_ffi:os_exit(1), erlang:error(#{gleam_error => panic, message => <<"unreachable"/utf8>>, module => <<"go_over/util/util"/utf8>>, function => <<"hard_fail"/utf8>>, line => 34}) end. -file("/home/bwireman/src/go-over/src/go_over/util/util.gleam", 39). -spec has_flag(list(binary()), binary()) -> boolean(). has_flag(Args, Name) -> gleam@list:any(Args, fun(Arg) -> Arg =:= (<<"--"/utf8, Name/binary>>) end). -file("/home/bwireman/src/go-over/src/go_over/util/util.gleam", 43). -spec retry_cmd(binary(), list(binary())) -> {ok, binary()} | {error, {integer(), binary()}}. retry_cmd(Cmd, Args) -> _pipe = delay:delay_effect( fun() -> shellout:command(Cmd, Args, <<"."/utf8>>, []) end ), _pipe@1 = delay:retry_with_backoff(_pipe, 3), delay:run(_pipe@1). -file("/home/bwireman/src/go-over/src/go_over/util/util.gleam", 54). -spec freeze1(fun((SMZ) -> SNA), SMZ) -> fun(() -> SNA). freeze1(F, Arg1) -> fun() -> F(Arg1) end. -file("/home/bwireman/src/go-over/src/go_over/util/util.gleam", 58). -spec freeze2(fun((SNB, SNC) -> SND), SNB, SNC) -> fun(() -> SND). freeze2(F, Arg1, Arg2) -> fun() -> F(Arg1, Arg2) end.