Current section
Files
Jump to
Current section
Files
src/examples@list.erl
-module(examples@list).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]).
-export([main/0]).
-spec main() -> {ok, {ok, binary()} | {error, {integer(), binary()}}} |
{error, {integer(), binary()}}.
main() ->
_pipe = [<<"zenity"/utf8>>],
_pipe@1 = gu:new_list(_pipe),
_pipe@2 = gu:set_title(_pipe@1, <<"List"/utf8>>),
_pipe@3 = gu:new_list_opts(
_pipe@2,
false,
false,
false,
{some, <<"|"/utf8>>},
true,
false,
none,
{some, 1},
false
),
_pipe@4 = gu:add_column(_pipe@3, <<"Language"/utf8>>),
_pipe@5 = gu:add_column(_pipe@4, <<"1"/utf8>>),
_pipe@6 = gu:add_column(_pipe@5, <<"2"/utf8>>),
_pipe@7 = gu:add_column(_pipe@6, <<"3"/utf8>>),
_pipe@8 = gu:add_row(
_pipe@7,
[<<"English"/utf8>>, <<"One"/utf8>>, <<"Two"/utf8>>, <<"Three"/utf8>>]
),
_pipe@9 = gu:add_row(
_pipe@8,
[<<"Esperanto"/utf8>>, <<"Unu"/utf8>>, <<"Du"/utf8>>, <<"Tri"/utf8>>]
),
_pipe@10 = gu:add_row(
_pipe@9,
[<<"Turkish"/utf8>>, <<"Bir"/utf8>>, <<"İki"/utf8>>, <<"Üç"/utf8>>]
),
_pipe@11 = gu:add_row(
_pipe@10,
[<<"Bulgarian"/utf8>>,
<<"Едно"/utf8>>,
<<"Две"/utf8>>,
<<"Три"/utf8>>]
),
_pipe@12 = gu:prompt(_pipe@11),
_pipe@13 = gleam@result:map(
_pipe@12,
fun(_capture) -> gleam@string:split(_capture, <<"|"/utf8>>) end
),
gleam@result:map(_pipe@13, fun(Answer) -> _pipe@14 = [<<"zenity"/utf8>>],
_pipe@15 = gu:new_info(_pipe@14),
_pipe@16 = gu:set_text(
_pipe@15,
gleam@string:join(Answer, <<", "/utf8>>)
),
_pipe@17 = gu:set_timeout(_pipe@16, 10),
gu:show(_pipe@17, true) end).