Current section
Files
Jump to
Current section
Files
src/go_over@util@util.erl
-module(go_over@util@util).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]).
-export([hard_fail/2, has_flag/2, retry_cmd/2]).
-file("/home/bwireman/src/go-over/src/go_over/util/util.gleam", 6).
-spec hard_fail({ok, TEF} | {error, any()}, binary()) -> TEF.
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 => 12})
end.
-file("/home/bwireman/src/go-over/src/go_over/util/util.gleam", 17).
-spec has_flag(list(binary()), binary()) -> boolean().
has_flag(Args, Name) ->
gleam@list:contains(Args, <<"--"/utf8, Name/binary>>).
-file("/home/bwireman/src/go-over/src/go_over/util/util.gleam", 21).
-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).