Merge pull request #206 from sigmaSd/refactor
[ouch.git] / src / macros.rs
blob49fd87c6a0d270d058fd3ce9fac33b04479a1562
1 //! Macros used on ouch.
3 /// Macro that prints \[INFO\] messages, wraps [`println`].
4 #[macro_export]
5 macro_rules! info {
6     ($($arg:tt)*) => {
7         $crate::macros::_info_helper();
8         println!($($arg)*);
9     };
12 /// Helper to display "\[INFO\]", colored yellow
13 pub fn _info_helper() {
14     use crate::utils::colors::{RESET, YELLOW};
16     print!("{}[INFO]{} ", *YELLOW, *RESET);
19 /// Macro that prints \[WARNING\] messages, wraps [`println`].
20 #[macro_export]
21 macro_rules! warning {
22     ($($arg:tt)*) => {
23         $crate::macros::_warning_helper();
24         println!($($arg)*);
25     };
28 /// Helper to display "\[WARNING\]", colored orange
29 pub fn _warning_helper() {
30     use crate::utils::colors::{ORANGE, RESET};
32     print!("{}[WARNING]{} ", *ORANGE, *RESET);