1use std::fmt::Display;
2
3use clap::{Parser, ValueEnum};
4
5mod clippy;
6mod tests;
7mod tidy;
8mod utils;
9
10#[derive(Debug, Parser)]
11enum Commands {
12 RunTests(tests::TestArgs),
16 Clippy(clippy::ClippyArgs),
18 Tidy(tidy::TidyArgs),
25}
26
27impl Commands {
28 fn run(self) {
29 match self {
30 Commands::RunTests(test_args) => test_args.run(),
31 Commands::Clippy(clippy) => clippy.run(),
32 Commands::Tidy(tidy) => tidy.run(),
33 }
34 }
35}
36
37#[derive(Debug, Clone, Copy, ValueEnum)]
38enum Backend {
39 Postgres,
40 Sqlite,
41 Mysql,
42 All,
43}
44
45impl Backend {
46 const ALL: &'static [Self] = &[Backend::Postgres, Backend::Sqlite, Backend::Mysql];
47}
48
49impl Display for Backend {
50 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
51 match self {
52 Backend::Postgres => write!(f, "postgres"),
53 Backend::Sqlite => write!(f, "sqlite"),
54 Backend::Mysql => write!(f, "mysql"),
55 Backend::All => write!(f, "all"),
56 }
57 }
58}
59
60fn main() {
61 dotenvy::dotenv().ok();
62 Commands::parse().run();
63}