Current section

Files

Jump to
startest src startest@internal@gleam_toml.erl
Raw

src/startest@internal@gleam_toml.erl

-module(startest@internal@gleam_toml).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]).
-export([read_name/0]).
-spec read_name() -> {ok, binary()} | {error, binary()}.
read_name() ->
gleam@result:'try'(
begin
_pipe = simplifile:read(<<"gleam.toml"/utf8>>),
gleam@result:map_error(
_pipe,
fun(Err) ->
<<"Failed to read `gleam.toml`: "/utf8,
(simplifile:describe_error(Err))/binary>>
end
)
end,
fun(Toml) ->
gleam@result:'try'(
begin
_pipe@1 = tom:parse(Toml),
gleam@result:map_error(
_pipe@1,
fun(Err@1) ->
<<"Failed to parse `gleam.toml`: "/utf8,
(gleam@string:inspect(Err@1))/binary>>
end
)
end,
fun(Toml@1) -> _pipe@2 = Toml@1,
_pipe@3 = tom:get_string(_pipe@2, [<<"name"/utf8>>]),
gleam@result:map_error(
_pipe@3,
fun(Err@2) ->
<<"Failed to read `name` from `gleam.toml`: "/utf8,
(gleam@string:inspect(Err@2))/binary>>
end
) end
)
end
).