boxy-cli
A Crate to create boxes in command-line interfaces with Rust
Dual-licensed under Apache 2.0 or MIT.
About:
boxy-cli is a crate to create simple textboxes in command-line interfaces, with a simple and easy-to-use design.
How to use:
Using the Builder:
you can directly create (and simutaneously print the textbox) using the BoxyBuilder Struct. here is how to use it:
Importing the necessary:
use *;
use BoxPad;
Next, you can create the BoxyBuilder struct
let mut my_box = builder
.box_type
.color
.padding
.align
.add_segment
.add_line
.add_segment
.width
.build;
and now, display it:
my_box.display;
Or do both simultanrously:
builder
.box_type
.color
.padding
.align
.add_segment
.add_line
.add_segment
.width
.build
.display;
further, you can use the same methods as displayed above to modify the textbox before building.
But you can also modify the textbox after building it (before displaying) using the methods shown in the following section.
Using the Struct and methods.
First import the crate into the current scope, using:
use *;
use BoxPad;
Next you create a new boxy struct with either the new method:
let mut box1 = new;
or the macro:
let mut box2 = boxy!;
for more info on the macro, view the macro documentation
Next, we just add in text sections:
box1.add_text_sgmt;
Add some more text to the same segment (or the latest segment):
box1.add_text_line;
or to a segment with a particular index:
box1.add_text_line_indx;
Once you are done, just display the TextBox:
box1.display;
the text colour is a required argument, and will be implemented into a usable feature in the very near future. But for now, it does not work
Examples:
Example 1
use *;
Example 2 (with the macro)
use *;