#![warn(clippy::pedantic)]
mod cli;
mod subcommand;
use crate::cli::Cli;
use clap::Parser;
use console::Style;
use std::fmt::Display;
pub const VERSION: &str = env!("CARGO_PKG_VERSION");
pub const AUTHORS: &str = env!("CARGO_PKG_AUTHORS");
pub const REPOSITORY: &str = env!("CARGO_PKG_REPOSITORY");
fn main() {
Cli::parse().run();
}
#[allow(clippy::needless_pass_by_value)]
pub fn print_error<T: Display, U: Display>(error: (T, U)) {
const ERROR_STYLE: Style = Style::new().bold().red();
const TIP_STYLE: Style = Style::new().green();
eprintln!("{} {}", ERROR_STYLE.apply_to("error:"), error.0);
eprintln!();
eprintln!(" {} {}", TIP_STYLE.apply_to("tip:"), error.1);
}
#[allow(clippy::needless_pass_by_value)]
pub fn single_line_error<T: ToString, U: ToString>(error: (T, U)) -> String {
let mut single_line_error = error.0.to_string();
single_line_error.push_str(": ");
single_line_error.push_str(&error.1.to_string());
single_line_error
}
pub fn print_success<T: Display>(message: T) {
const SUCCESS_STYLE: Style = Style::new().bold().green();
println!("{} {}", SUCCESS_STYLE.apply_to("success:"), message);
}