Current section

Files

Jump to
glint src glint@style.erl
Raw

src/glint@style.erl

-module(glint@style).
-compile(no_auto_import).
-export([lookups/1, heading/3]).
-export_type([pretty_help/0]).
-type pretty_help() :: {pretty_help,
list(binary()),
list(binary()),
list(binary())}.
-spec lookups(pretty_help()) -> list({list(binary()),
list({binary(), list(binary())})}).
lookups(Pretty) ->
[{[<<"color"/utf8>>, <<"background"/utf8>>],
[{<<"usage"/utf8>>, erlang:element(2, Pretty)},
{<<"flags"/utf8>>, erlang:element(3, Pretty)},
{<<"subcommands"/utf8>>, erlang:element(4, Pretty)}]}].
-spec heading(
list({list(binary()), list({binary(), list(binary())})}),
binary(),
binary()
) -> binary().
heading(Lookups, Heading, Colour) ->
_pipe = shellout:display(
[<<"bold"/utf8>>, <<"italic"/utf8>>, <<"underline"/utf8>>]
),
_pipe@1 = gleam@map:merge(_pipe, shellout:color([Colour])),
shellout:style(Heading, _pipe@1, Lookups).