Packages
glint
0.10.0
1.3.0
1.2.1
1.2.0
1.1.1
1.1.0
1.0.1
1.0.0
1.0.0-rc5
1.0.0-rc4
1.0.0-rc3
1.0.0-rc2
1.0.0-rc1
0.18.1
0.18.0
0.17.1
0.17.0
0.16.0
0.16.0-rc1
0.15.0
0.15.0-rc2
0.15.0-rc1
0.14.0
0.13.0
0.12.0
0.12.0-rc6
0.12.0-rc5
0.12.0-rc4
0.12.0-rc3
0.12.0-rc2
0.12.0-rc1
0.11.4
0.11.3
0.11.2
0.11.0
0.10.0
0.9.0
0.8.0
0.7.4
0.7.3
0.7.2
0.7.1
0.7.0
0.6.0
0.5.0
0.4.0
0.3.0
0.2.0
0.1.3
0.1.2
0.1.1
0.1.0
Gleam command-line argument parsing with flags and automated help text generation.
Current section
Files
Jump to
Current section
Files
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).