Current section
Files
Jump to
Current section
Files
src/startest@internal@gleam_toml.erl
-module(startest@internal@gleam_toml).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]).
-define(FILEPATH, "src/startest/internal/gleam_toml.gleam").
-export([read_name/0]).
-if(?OTP_RELEASE >= 27).
-define(MODULEDOC(Str), -moduledoc(Str)).
-define(DOC(Str), -doc(Str)).
-else.
-define(MODULEDOC(Str), -compile([])).
-define(DOC(Str), -compile([])).
-endif.
?MODULEDOC(false).
-file("src/startest/internal/gleam_toml.gleam", 9).
?DOC(false).
-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
).