Skip to content

Commit

Permalink
Make cprint! use cformat!
Browse files Browse the repository at this point in the history
  • Loading branch information
Sellig6792 committed May 3, 2024
1 parent d08102d commit ffd9f45
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 17 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ path = "src/lib.rs"
[features]
default = ["cprint"]
coloration = []
cprint = ["coloration"]
ceprint = ["coloration"]
cformat = ["coloration"]
cprint = ["coloration", "cformat"]
ceprint = ["coloration"]

[package.metadata.docs.rs]
all-features = true
Expand Down
16 changes: 1 addition & 15 deletions src/cprint/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,7 @@
#[macro_export]
macro_rules! cprint {
($title:expr, $msg:expr, $color:expr) => {{
use std::io::Write;
use $crate::coloration::Coloration;

let white_spaces = $title
.chars()
.filter(|c| c.is_whitespace())
.collect::<String>();
let title = $title.trim_start();

print!(
"{}{} {}",
white_spaces,
format!("{}{}", " ".repeat(12 - title.len()), title).apply_color($color),
$msg
);
print!("{}", $crate::cformat!($title, $msg, $color));
}};
}

Expand Down

0 comments on commit ffd9f45

Please sign in to comment.