Boxer

Wraps a terminal message in boxes.

sample image

Add to rebar.config


{deps, [
    ...,
    boxer %% <- add this right here
]}.

Functions

Printing and Formatting

Customization

You can customize the box-style by creating new definitions (or changing the existing ones)

Formatting the custom definitions

A Line Definition (Box Style) consists of the following information:

#{
    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
}

Adding via the Erlang shell

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).

Adding via configuration

To add the above dot example via config, add the following to your app.config:


[
    {boxer, [
        {boxer_line_defs, [
            {dots, #{chars=>"......", h_padding=>1}}
        ]}
    ]}
].

Comments and Contribution

Pull requests and Issues welcome!

Thanks!

License and Copyright

Copyright 2024 Jesse Gumm

Licensed under the Apache 2.0 License