-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from Sellig6792/develop
v0.3.0
- Loading branch information
Showing
6 changed files
with
112 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
[package] | ||
name = "cprint" | ||
description = "Cargo-like print" | ||
version = "0.2.0" | ||
version = "0.3.0" | ||
edition = "2021" | ||
authors = ["Sellig6792 <[email protected]>"] | ||
homepage = "https://github.com/Sellig6792/cprint" | ||
|
@@ -14,6 +14,11 @@ license = "MIT" | |
name = "cprint" | ||
path = "src/lib.rs" | ||
|
||
[features] | ||
default = ["cprint"] | ||
coloration = [] | ||
cprint = ["coloration"] | ||
ceprint = ["coloration"] | ||
|
||
[dependencies] | ||
colored = "2.0.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/// Print an error like Cargo does. The argument is the message of the error. | ||
/// The end of the title is padded with spaces to make it 12 characters long. | ||
/// # Examples | ||
/// ```rust | ||
/// use cprint::{ceprint, Color, Coloration}; | ||
/// | ||
/// ceprint!("Failed to compile"); | ||
/// ``` | ||
#[macro_export] | ||
macro_rules! ceprint { | ||
($msg:expr) => { | ||
print!( | ||
"{} {}", | ||
format!("{}{}", " ".repeat(12 - "Error".len()), "Error").apply_color(Color::Red), | ||
$msg | ||
); | ||
}; | ||
} | ||
|
||
/// Same as [`ceprint!`] but with a newline at the end. | ||
#[macro_export] | ||
macro_rules! ceprintln { | ||
($title:expr, $msg:expr) => { | ||
ceprintln!($title, $msg, Color::Red); | ||
}; | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters