Wraps a terminal message in boxes.
{deps, [
...,
boxer %% <- add this right here
]}.
boxer:print(Msg)
: Prints a message with the default box style (single-line)boxer:print(Msg, LineDefName)
: Prints a message with the specifiedLineDefName
(by default, supported are the atomssingle
,double
, andhash
).boxer:wrap(Msg)
: Returns a unicode string list wrapped in the default box style (single-line
).boxer:wrap(Msg, LineDefName)
: Returns a unicode string list wrapped in the specifiedLineDef
.
You can customize the box-style by creating new definitions (or changing the existing ones)
A Line Definition (Box Style) consists of the following information:
- A name (like
double
orsingle
) - A map with the following fields:
#{
chars =>
[Horiz, Vert, TopLeft, TopRight, BottomRight, BottomLeft],
h_padding =>
HorizontalPadding,
v_padding =>
VerticalPadding
}
For example, the single
line definition looks like this:
#{
chars => "─│┌┐┘└",
h_padding => 0,
v_padding => 0
}
Here's how to add a sample definition that makes a simple border using just periods (dots).
Def = #{chars=>"......", h_padding=>1},
boxer:add_line_def(dots, Def).
To add the above dot example via config, add the following to your app.config
:
[
{boxer, [
{boxer_line_defs, [
{dots, #{chars=>"......", h_padding=>1}}
]}
]}
].
Pull requests and Issues welcome!
Thanks!
Copyright 2024 Jesse Gumm
Licensed under the Apache 2.0 License