use std::fmt::Display;
use clap::{Parser, ValueEnum};
mod clippy;
mod tests;
mod tidy;
mod utils;
#[derive(Debug, Parser)]
enum Commands {
RunTests(tests::TestArgs),
Clippy(clippy::ClippyArgs),
Tidy(tidy::TidyArgs),
}
impl Commands {
fn run(self) {
match self {
Commands::RunTests(test_args) => test_args.run(),
Commands::Clippy(clippy) => clippy.run(),
Commands::Tidy(tidy) => tidy.run(),
}
}
}
#[derive(Debug, Clone, Copy, ValueEnum)]
enum Backend {
Postgres,
Sqlite,
Mysql,
All,
}
impl Backend {
const ALL: &'static [Self] = &[Backend::Postgres, Backend::Sqlite, Backend::Mysql];
}
impl Display for Backend {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Backend::Postgres => write!(f, "postgres"),
Backend::Sqlite => write!(f, "sqlite"),
Backend::Mysql => write!(f, "mysql"),
Backend::All => write!(f, "all"),
}
}
}
fn main() {
dotenvy::dotenv().ok();
Commands::parse().run();
}