| |
}
|
| |
|
| |
#[macro_export]
|
| + |
macro_rules! warning {
|
| + |
// Pattern when a writer is provided.
|
| + |
($writer:expr; $($arg:tt)*) => ({
|
| + |
$crate::io::warning_args($writer, format_args!($($arg)*));
|
| + |
});
|
| + |
// Pattern without writer.
|
| + |
($($arg:tt)*) => ({
|
| + |
$crate::io::warning_args(&mut std::io::stdout(), format_args!($($arg)*));
|
| + |
});
|
| + |
}
|
| + |
|
| + |
#[macro_export]
|
| + |
macro_rules! error {
|
| + |
// Pattern when a writer is provided.
|
| + |
($writer:expr; $($arg:tt)*) => ({
|
| + |
$crate::io::error_args($writer, format_args!($($arg)*));
|
| + |
});
|
| + |
// Pattern without writer.
|
| + |
($($arg:tt)*) => ({
|
| + |
$crate::io::error_args(&mut std::io::stdout(), format_args!($($arg)*));
|
| + |
});
|
| + |
}
|
| + |
|
| + |
#[macro_export]
|
| |
macro_rules! tip {
|
| |
($($arg:tt)*) => ({
|
| |
$crate::io::tip_args(format_args!($($arg)*));
|
| |
pub use tip;
|
| |
|
| |
pub fn success_args<W: io::Write>(w: &mut W, args: fmt::Arguments) {
|
| - |
writeln!(w, "{} {args}", Paint::green("✓")).ok();
|
| + |
writeln!(w, "{} {args}", SUCCESS_PREFIX).ok();
|
| + |
}
|
| + |
|
| + |
pub fn warning_args<W: io::Write>(w: &mut W, args: fmt::Arguments) {
|
| + |
writeln!(w, "{} {args}", WARNING_PREFIX).ok();
|
| + |
}
|
| + |
|
| + |
pub fn error_args<W: io::Write>(w: &mut W, args: fmt::Arguments) {
|
| + |
writeln!(w, "{} {args}", ERROR_PREFIX).ok();
|
| |
}
|
| |
|
| |
pub fn tip_args(args: fmt::Arguments) {
|