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