aboutsummaryrefslogtreecommitdiff
path: root/bin/src/main.rs
blob: fabc5098db7487e2fd77a2286c1c1b648449e27d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
mod config;
mod dirs;
mod err;
mod explain;
mod fix;
mod lint;
mod traits;

use crate::err::StatixErr;

use clap::Clap;
use config::{Opts, SubCommand};

fn _main() -> Result<(), StatixErr> {
    let opts = Opts::parse();
    match opts.cmd {
        SubCommand::Check(config) => lint::main::main(config),
        SubCommand::Fix(config) => fix::main::all(config),
        SubCommand::Single(config) => fix::main::single(config),
        SubCommand::Explain(config) => explain::main::main(config),
    }
}

fn main() {
    if let Err(e) = _main() {
        eprintln!("{}", e);
    }
}