mirror of
https://github.com/BastaMasta/boxy-cli.git
synced 2026-07-28 18:35:39 +03:00
minor code re-formatting
This commit is contained in:
@@ -1,16 +1,16 @@
|
||||
mod tests;
|
||||
|
||||
use boxy_cli::prelude::*;
|
||||
use terminal_size::terminal_size;
|
||||
use std::time::Instant;
|
||||
use terminal_size::terminal_size;
|
||||
|
||||
fn main() {
|
||||
let mut box1 = Boxy::new(BoxType::Bold,"#00ffff");
|
||||
let mut box1 = Boxy::new(BoxType::Bold, "#00ffff");
|
||||
println!("Terminal Size: {:?}", terminal_size());
|
||||
box1.add_text_sgmt("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur", "#00ffff", BoxAlign::Left);
|
||||
box1.add_text_sgmt("Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo.", "#ffff", BoxAlign::Center);
|
||||
box1.add_text_sgmt("Hello Theree", "#00ffff", BoxAlign::Center);
|
||||
box1.set_padding(BoxPad::from_tldr(1,2,3,4), BoxPad::uniform(0));
|
||||
box1.set_padding(BoxPad::from_tldr(1, 2, 3, 4), BoxPad::uniform(0));
|
||||
println!("{:#?}", box1);
|
||||
// Post-line insert check
|
||||
println!("{:?}", box1);
|
||||
@@ -22,7 +22,7 @@ fn main() {
|
||||
let mut box2 = boxy!(type: BoxType::Double, color:"#00ffff");
|
||||
box2.add_text_sgmt("Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo ", "#ffff", BoxAlign::Left);
|
||||
box2.add_text_line("Hello There Boi", "#32CD32");
|
||||
box2.set_padding(BoxPad::from_tldr(1,2,3,4), BoxPad::uniform(7));
|
||||
box2.set_padding(BoxPad::from_tldr(1, 2, 3, 4), BoxPad::uniform(7));
|
||||
let start1 = Instant::now();
|
||||
box2.display();
|
||||
let duration1 = start1.elapsed();
|
||||
|
||||
+27
-31
@@ -1,35 +1,31 @@
|
||||
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use boxy_cli::prelude::*;
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
fn validate_runtime(time: Duration) -> Result<(), String> {
|
||||
if time < Duration::from_millis(100) {
|
||||
Ok(())
|
||||
}
|
||||
else {
|
||||
panic!("\n\nRuntime exceeding upper limit!!!\n\n")
|
||||
}
|
||||
}
|
||||
#[test]
|
||||
fn bechmark_test() {
|
||||
let mut box1 = Boxy::new(BoxType::Bold,"#00ffff");
|
||||
box1.add_text_sgmt("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur", "#ffff", BoxAlign::Left);
|
||||
box1.add_text_sgmt("Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo.", "#ffff", BoxAlign::Center);
|
||||
box1.add_text_sgmt("Hello Theree", "#ffff", BoxAlign::Right);
|
||||
let start = Instant::now();
|
||||
box1.display();
|
||||
let duration = start.elapsed();
|
||||
let mut box2 = boxy!(type: BoxType::Double, color:"#00ffff");
|
||||
box2.add_text_sgmt("Hello There Mateojablij trhwesoiuethj 0piswe hjgtgoise jgtowie3thj q3o-oitujpwiej toiq 0iweeh gt owjtpiewrwh WOKWRHJ JRQWE4IHYNE5R bfg oiwhf apeih aepih aepih aepihetm wf[ohgwlMRF [POWQWRF]] [OJTQEA [OJ]]OJBDGISUDBG SIUGRG OGUFOSIJGOSN SOGUIHSGIORNGR ORIRHGOSJRNGOIJRG OPIFGHRPGNPERIJG ORIRGRPIGNERPGOSJH ", "#ffff", BoxAlign::Center);
|
||||
box2.add_text_sgmt("Hello Theree", "#ffff", BoxAlign::Right);
|
||||
let start1 = Instant::now();
|
||||
box2.display();
|
||||
let duration1 = start1.elapsed();
|
||||
assert!(validate_runtime(duration).is_ok());
|
||||
assert!(validate_runtime(duration1).is_ok());
|
||||
}
|
||||
use boxy_cli::prelude::*;
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
fn validate_runtime(time: Duration) -> Result<(), String> {
|
||||
if time < Duration::from_millis(100) {
|
||||
Ok(())
|
||||
} else {
|
||||
panic!("\n\nRuntime exceeding upper limit!!!\n\n")
|
||||
}
|
||||
}
|
||||
#[test]
|
||||
fn bechmark_test() {
|
||||
let mut box1 = Boxy::new(BoxType::Bold, "#00ffff");
|
||||
box1.add_text_sgmt("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur", "#ffff", BoxAlign::Left);
|
||||
box1.add_text_sgmt("Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo.", "#ffff", BoxAlign::Center);
|
||||
box1.add_text_sgmt("Hello Theree", "#ffff", BoxAlign::Right);
|
||||
let start = Instant::now();
|
||||
box1.display();
|
||||
let duration = start.elapsed();
|
||||
let mut box2 = boxy!(type: BoxType::Double, color:"#00ffff");
|
||||
box2.add_text_sgmt("Hello There Mateojablij trhwesoiuethj 0piswe hjgtgoise jgtowie3thj q3o-oitujpwiej toiq 0iweeh gt owjtpiewrwh WOKWRHJ JRQWE4IHYNE5R bfg oiwhf apeih aepih aepih aepihetm wf[ohgwlMRF [POWQWRF]] [OJTQEA [OJ]]OJBDGISUDBG SIUGRG OGUFOSIJGOSN SOGUIHSGIORNGR ORIRHGOSJRNGOIJRG OPIFGHRPGNPERIJG ORIRGRPIGNERPGOSJH ", "#ffff", BoxAlign::Center);
|
||||
box2.add_text_sgmt("Hello Theree", "#ffff", BoxAlign::Right);
|
||||
let start1 = Instant::now();
|
||||
box2.display();
|
||||
let duration1 = start1.elapsed();
|
||||
assert!(validate_runtime(duration).is_ok());
|
||||
assert!(validate_runtime(duration1).is_ok());
|
||||
}
|
||||
}
|
||||
|
||||
+14
-15
@@ -16,7 +16,7 @@ use std::fmt::Display;
|
||||
/// let mut box3 = Boxy::new(BoxType::Bold, "#00ffff");
|
||||
/// ```
|
||||
#[derive(Debug, Default)]
|
||||
pub enum BoxType{
|
||||
pub enum BoxType {
|
||||
/// Simple ASCII-style box using `+` for corners and `-` for borders
|
||||
Classic,
|
||||
/// Default style using single-line Unicode box drawing characters
|
||||
@@ -39,7 +39,7 @@ pub enum BoxType{
|
||||
}
|
||||
|
||||
// Added Display Fucntion to resolve type errors in the macro
|
||||
impl Display for BoxType{
|
||||
impl Display for BoxType {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
let str = match &self {
|
||||
BoxType::Classic => "classic".to_string(),
|
||||
@@ -101,7 +101,6 @@ impl Display for BoxAlign {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// Represents padding values for the text box in all four directions.
|
||||
///
|
||||
/// `BoxPad` is used to specify padding between:
|
||||
@@ -152,11 +151,11 @@ impl BoxPad {
|
||||
/// // Equivalent to BoxPad { top: 0, down: 0, left: 0, right: 0 }
|
||||
/// ```
|
||||
pub fn new() -> Self {
|
||||
BoxPad{
|
||||
BoxPad {
|
||||
top: 0,
|
||||
down: 0,
|
||||
left: 0,
|
||||
right: 0
|
||||
right: 0,
|
||||
}
|
||||
}
|
||||
/// Creates a new `BoxPad` with specific values for each side.
|
||||
@@ -180,11 +179,11 @@ impl BoxPad {
|
||||
/// // top: 2, left: 4, down: 2, right: 4
|
||||
/// ```
|
||||
pub fn from_tldr(top: usize, left: usize, down: usize, right: usize) -> Self {
|
||||
BoxPad{
|
||||
BoxPad {
|
||||
top,
|
||||
down,
|
||||
left,
|
||||
right
|
||||
right,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -203,12 +202,12 @@ impl BoxPad {
|
||||
/// let padding = BoxPad::uniform(3);
|
||||
/// // Equivalent to BoxPad { top: 3, down: 3, left: 3, right: 3 }
|
||||
/// ```
|
||||
pub fn uniform(pad: usize) -> Self{
|
||||
BoxPad{
|
||||
pub fn uniform(pad: usize) -> Self {
|
||||
BoxPad {
|
||||
top: pad,
|
||||
down: pad,
|
||||
left: pad,
|
||||
right: pad
|
||||
right: pad,
|
||||
}
|
||||
}
|
||||
/// Creates a new `BoxPad` with separate values for vertical and horizontal padding.
|
||||
@@ -230,16 +229,16 @@ impl BoxPad {
|
||||
/// let padding = BoxPad::vh(1, 3);
|
||||
/// // Equivalent to BoxPad { top: 1, down: 1, left: 3, right: 3 }
|
||||
/// ```
|
||||
pub fn vh(vertical: usize, horizontal: usize) -> Self{
|
||||
BoxPad{
|
||||
pub fn vh(vertical: usize, horizontal: usize) -> Self {
|
||||
BoxPad {
|
||||
top: vertical,
|
||||
down: vertical,
|
||||
left: horizontal,
|
||||
right: horizontal
|
||||
right: horizontal,
|
||||
}
|
||||
}
|
||||
/// returns the total padidng on either side. used for text wrapping and display time calculations
|
||||
pub fn lr(&self) -> usize{
|
||||
pub fn lr(&self) -> usize {
|
||||
self.right + self.left
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -43,10 +43,10 @@
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub mod boxer;
|
||||
pub(crate) mod templates;
|
||||
pub mod macros;
|
||||
pub mod constructs;
|
||||
pub mod macros;
|
||||
pub mod prelude;
|
||||
pub(crate) mod templates;
|
||||
|
||||
// Re-export prelude at crate root
|
||||
pub use prelude::*;
|
||||
pub use prelude::*;
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
/// # }
|
||||
/// ```
|
||||
/// ! The segcount sets the number of segments in the box. If text for only two segments is provided, the third segment will be displayed empty.
|
||||
///
|
||||
///
|
||||
/// ! The padding values here are taken to be for uniform padding on all sides.
|
||||
#[macro_export]
|
||||
macro_rules! boxy {
|
||||
@@ -48,4 +48,4 @@ macro_rules! boxy {
|
||||
)*
|
||||
boxy
|
||||
}};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,5 +13,5 @@
|
||||
//! ```
|
||||
|
||||
pub use crate::boxer::*;
|
||||
pub use crate::constructs::{BoxType, BoxAlign, BoxPad};
|
||||
pub use crate::boxy;
|
||||
pub use crate::boxy;
|
||||
pub use crate::constructs::{BoxAlign, BoxPad, BoxType};
|
||||
|
||||
+121
-121
@@ -1,141 +1,141 @@
|
||||
//! The structs for the box border characters
|
||||
#[allow(dead_code)]
|
||||
pub(crate) struct BoxTemplates {
|
||||
pub(crate) top_left : char,
|
||||
pub(crate) top_right : char,
|
||||
pub(crate) bottom_left : char,
|
||||
pub(crate) bottom_right : char,
|
||||
pub(crate) vertical : char,
|
||||
pub(crate) horizontal : char,
|
||||
pub(crate) left_t : char,
|
||||
pub(crate) right_t : char,
|
||||
pub(crate) upper_t : char,
|
||||
pub(crate) lower_t : char,
|
||||
pub(crate) cross : char,
|
||||
pub(crate) struct BoxTemplates {
|
||||
pub(crate) top_left: char,
|
||||
pub(crate) top_right: char,
|
||||
pub(crate) bottom_left: char,
|
||||
pub(crate) bottom_right: char,
|
||||
pub(crate) vertical: char,
|
||||
pub(crate) horizontal: char,
|
||||
pub(crate) left_t: char,
|
||||
pub(crate) right_t: char,
|
||||
pub(crate) upper_t: char,
|
||||
pub(crate) lower_t: char,
|
||||
pub(crate) cross: char,
|
||||
}
|
||||
|
||||
pub(crate) const SINGLE_TEMPLATE : BoxTemplates = BoxTemplates {
|
||||
top_left : '┌',
|
||||
top_right : '┐',
|
||||
bottom_left : '└',
|
||||
bottom_right : '┘',
|
||||
vertical : '│',
|
||||
horizontal : '─',
|
||||
left_t : '├',
|
||||
right_t : '┤',
|
||||
upper_t : '┬',
|
||||
lower_t : '┴',
|
||||
cross : '┼',
|
||||
pub(crate) const SINGLE_TEMPLATE: BoxTemplates = BoxTemplates {
|
||||
top_left: '┌',
|
||||
top_right: '┐',
|
||||
bottom_left: '└',
|
||||
bottom_right: '┘',
|
||||
vertical: '│',
|
||||
horizontal: '─',
|
||||
left_t: '├',
|
||||
right_t: '┤',
|
||||
upper_t: '┬',
|
||||
lower_t: '┴',
|
||||
cross: '┼',
|
||||
};
|
||||
|
||||
pub(crate) const DOUB_H_TEMPLATE : BoxTemplates = BoxTemplates {
|
||||
top_left : '╒',
|
||||
top_right : '╕',
|
||||
bottom_left : '╘',
|
||||
bottom_right : '╛',
|
||||
vertical : '│',
|
||||
horizontal : '═',
|
||||
left_t : '╞',
|
||||
right_t : '╡',
|
||||
upper_t : '╤',
|
||||
lower_t : '╧',
|
||||
cross : '╪',
|
||||
pub(crate) const DOUB_H_TEMPLATE: BoxTemplates = BoxTemplates {
|
||||
top_left: '╒',
|
||||
top_right: '╕',
|
||||
bottom_left: '╘',
|
||||
bottom_right: '╛',
|
||||
vertical: '│',
|
||||
horizontal: '═',
|
||||
left_t: '╞',
|
||||
right_t: '╡',
|
||||
upper_t: '╤',
|
||||
lower_t: '╧',
|
||||
cross: '╪',
|
||||
};
|
||||
|
||||
pub(crate) const DOUB_V_TEMPLATE : BoxTemplates = BoxTemplates {
|
||||
top_right : '╖',
|
||||
top_left : '╓',
|
||||
bottom_right : '╜',
|
||||
bottom_left : '╙',
|
||||
horizontal : '─',
|
||||
vertical : '║',
|
||||
left_t : '╟',
|
||||
right_t : '╢',
|
||||
upper_t : '╥',
|
||||
lower_t : '╨',
|
||||
cross : '╫',
|
||||
pub(crate) const DOUB_V_TEMPLATE: BoxTemplates = BoxTemplates {
|
||||
top_right: '╖',
|
||||
top_left: '╓',
|
||||
bottom_right: '╜',
|
||||
bottom_left: '╙',
|
||||
horizontal: '─',
|
||||
vertical: '║',
|
||||
left_t: '╟',
|
||||
right_t: '╢',
|
||||
upper_t: '╥',
|
||||
lower_t: '╨',
|
||||
cross: '╫',
|
||||
};
|
||||
|
||||
pub(crate) const DOUBLE_TEMPLATE : BoxTemplates = BoxTemplates {
|
||||
top_right : '╗',
|
||||
top_left : '╔',
|
||||
bottom_right : '╝',
|
||||
bottom_left : '╚',
|
||||
horizontal : '═',
|
||||
vertical : '║',
|
||||
left_t : '╠',
|
||||
right_t : '╣',
|
||||
upper_t : '╦',
|
||||
lower_t : '╩',
|
||||
cross : '╬',
|
||||
pub(crate) const DOUBLE_TEMPLATE: BoxTemplates = BoxTemplates {
|
||||
top_right: '╗',
|
||||
top_left: '╔',
|
||||
bottom_right: '╝',
|
||||
bottom_left: '╚',
|
||||
horizontal: '═',
|
||||
vertical: '║',
|
||||
left_t: '╠',
|
||||
right_t: '╣',
|
||||
upper_t: '╦',
|
||||
lower_t: '╩',
|
||||
cross: '╬',
|
||||
};
|
||||
|
||||
pub(crate) const ROUNDED_TEMPLATE : BoxTemplates = BoxTemplates {
|
||||
top_right : '╮',
|
||||
top_left : '╭',
|
||||
bottom_right : '╯',
|
||||
bottom_left : '╰',
|
||||
horizontal : '─',
|
||||
vertical : '│',
|
||||
left_t : '├',
|
||||
right_t : '┤',
|
||||
upper_t : '┬',
|
||||
lower_t : '┴',
|
||||
cross : '┼',
|
||||
pub(crate) const ROUNDED_TEMPLATE: BoxTemplates = BoxTemplates {
|
||||
top_right: '╮',
|
||||
top_left: '╭',
|
||||
bottom_right: '╯',
|
||||
bottom_left: '╰',
|
||||
horizontal: '─',
|
||||
vertical: '│',
|
||||
left_t: '├',
|
||||
right_t: '┤',
|
||||
upper_t: '┬',
|
||||
lower_t: '┴',
|
||||
cross: '┼',
|
||||
};
|
||||
|
||||
pub(crate) const BOLD_TEMPLATE : BoxTemplates = BoxTemplates {
|
||||
top_right : '┓',
|
||||
top_left : '┏',
|
||||
bottom_right : '┛',
|
||||
bottom_left : '┗',
|
||||
horizontal : '━',
|
||||
vertical : '┃',
|
||||
left_t : '┣',
|
||||
right_t : '┫',
|
||||
upper_t : '┳',
|
||||
lower_t : '┻',
|
||||
cross : '╋',
|
||||
pub(crate) const BOLD_TEMPLATE: BoxTemplates = BoxTemplates {
|
||||
top_right: '┓',
|
||||
top_left: '┏',
|
||||
bottom_right: '┛',
|
||||
bottom_left: '┗',
|
||||
horizontal: '━',
|
||||
vertical: '┃',
|
||||
left_t: '┣',
|
||||
right_t: '┫',
|
||||
upper_t: '┳',
|
||||
lower_t: '┻',
|
||||
cross: '╋',
|
||||
};
|
||||
|
||||
pub(crate) const CLASSIC_TEMPLATE : BoxTemplates = BoxTemplates {
|
||||
top_right : '+',
|
||||
top_left : '+',
|
||||
bottom_right : '+',
|
||||
bottom_left : '+',
|
||||
horizontal : '-',
|
||||
vertical : '┇',
|
||||
left_t : '+',
|
||||
right_t : '+',
|
||||
upper_t : '+',
|
||||
lower_t : '+',
|
||||
cross : '+',
|
||||
pub(crate) const CLASSIC_TEMPLATE: BoxTemplates = BoxTemplates {
|
||||
top_right: '+',
|
||||
top_left: '+',
|
||||
bottom_right: '+',
|
||||
bottom_left: '+',
|
||||
horizontal: '-',
|
||||
vertical: '┇',
|
||||
left_t: '+',
|
||||
right_t: '+',
|
||||
upper_t: '+',
|
||||
lower_t: '+',
|
||||
cross: '+',
|
||||
};
|
||||
|
||||
pub(crate) const BOLD_CORNERS_TEMPLATE : BoxTemplates = BoxTemplates {
|
||||
top_right : '┓',
|
||||
top_left : '┏',
|
||||
bottom_right : '┛',
|
||||
bottom_left : '┗',
|
||||
horizontal : '─',
|
||||
vertical : '│',
|
||||
left_t : '├',
|
||||
right_t : '┤',
|
||||
upper_t : '┬',
|
||||
lower_t : '┴',
|
||||
cross : '┼',
|
||||
pub(crate) const BOLD_CORNERS_TEMPLATE: BoxTemplates = BoxTemplates {
|
||||
top_right: '┓',
|
||||
top_left: '┏',
|
||||
bottom_right: '┛',
|
||||
bottom_left: '┗',
|
||||
horizontal: '─',
|
||||
vertical: '│',
|
||||
left_t: '├',
|
||||
right_t: '┤',
|
||||
upper_t: '┬',
|
||||
lower_t: '┴',
|
||||
cross: '┼',
|
||||
};
|
||||
|
||||
pub(crate) const EMPTY_TEMPLATE : BoxTemplates = BoxTemplates {
|
||||
top_right : ' ',
|
||||
top_left : ' ',
|
||||
bottom_right : ' ',
|
||||
bottom_left : ' ',
|
||||
horizontal : ' ',
|
||||
vertical : ' ',
|
||||
left_t : ' ',
|
||||
right_t : ' ',
|
||||
upper_t : ' ',
|
||||
lower_t : ' ',
|
||||
cross : ' ',
|
||||
};
|
||||
pub(crate) const EMPTY_TEMPLATE: BoxTemplates = BoxTemplates {
|
||||
top_right: ' ',
|
||||
top_left: ' ',
|
||||
bottom_right: ' ',
|
||||
bottom_left: ' ',
|
||||
horizontal: ' ',
|
||||
vertical: ' ',
|
||||
left_t: ' ',
|
||||
right_t: ' ',
|
||||
upper_t: ' ',
|
||||
lower_t: ' ',
|
||||
cross: ' ',
|
||||
};
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use boxy_cli::prelude::*;
|
||||
use boxy_cli::constructs::Boxy;
|
||||
use boxy_cli::prelude::*;
|
||||
|
||||
fn main() {
|
||||
// Create a new Boxy instance
|
||||
@@ -8,9 +8,9 @@ fn main() {
|
||||
.color("#00ffff")
|
||||
.padding(BoxPad::uniform(1), BoxPad::from_tldr(2, 2, 1, 1))
|
||||
.align(BoxAlign::Center)
|
||||
.add_segment("Hello, Boxy!", "#ffffff")
|
||||
.add_segment("Hello, Boxy!", "#ffffff", BoxAlign::Center)
|
||||
.add_line("This is a new line.", "#32CD32")
|
||||
.add_segment("Another section", "#663399")
|
||||
.add_segment("Another section", "#663399", BoxAlign::Right)
|
||||
.width(50)
|
||||
.build()
|
||||
.display();
|
||||
|
||||
@@ -2,7 +2,7 @@ use boxy_cli::prelude::*;
|
||||
|
||||
fn main() {
|
||||
// Create a new Boxy instance
|
||||
let mut box1 = Boxy::new(BoxType::Bold,"#00ffff");
|
||||
let mut box1 = Boxy::new(BoxType::Bold, "#00ffff");
|
||||
|
||||
// Adding text segments with different colors
|
||||
box1.add_text_sgmt("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur", "#00ffff");
|
||||
@@ -11,4 +11,4 @@ fn main() {
|
||||
|
||||
// Display the box
|
||||
box1.display();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,5 +10,4 @@ fn main() {
|
||||
|
||||
// Display the box
|
||||
box1.display();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user