Current section
Files
Jump to
Current section
Files
src/cactus@util.erl
-module(cactus@util).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]).
-export([parse_manifest/1, toml_path/0]).
-spec parse_manifest(binary()) -> {ok, gleam@dict:dict(binary(), tom:toml())} |
{error, nil}.
parse_manifest(Path) ->
gleam@result:'try'(
begin
_pipe = simplifile:read(Path),
gleam@result:nil_error(_pipe)
end,
fun(Body) -> _pipe@1 = tom:parse(Body),
gleam@result:nil_error(_pipe@1) end
).
-spec toml_path() -> binary().
toml_path() ->
_assert_subject = simplifile:current_directory(),
{ok, Pwd} = case _assert_subject of
{ok, _} -> _assert_subject;
_assert_fail ->
erlang:error(#{gleam_error => let_assert,
message => <<"Assertion pattern match failed"/utf8>>,
value => _assert_fail,
module => <<"cactus/util"/utf8>>,
function => <<"toml_path"/utf8>>,
line => 12})
end,
filepath:join(Pwd, <<"gleam.toml"/utf8>>).