A command-line utility for PCsensor foot switches, written in Rust.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
footswitch-rs/src/messages.rs

39 lines
897 B

use colored::*;
use std::process;
#[macro_export]
macro_rules! info {
($($arg:tt)*) => {
println!("├ {:7} — {}", "Info".green(), format_args!($($arg)*));
};
}
#[macro_export]
macro_rules! warning {
($($arg:tt)*) => {
println!("├ {:7} — {}", "Warning".yellow(), format_args!($($arg)*));
};
}
#[macro_export]
macro_rules! error {
($($arg:tt)*) => {
{
eprintln!("└ {:7} — {}", "Error".on_red().white(), format_args!($($arg)*));
println!("");
process::exit(0);
}
};
}
pub fn welcome(string: &str) {
println!("┌{}┐", "─".repeat(string.len() + 20));
println!("│{text:^-width$}│", text = string, width = string.len() + 20);
println!("├{}┘", "─".repeat(string.len() + 20));
}
pub fn goodbye() {
println!("└ {:7}", "Goodbye!".green());
process::exit(0);
}