aboutsummaryrefslogtreecommitdiff
path: root/bin/src/main.rs
blob: ebd230e5a13ecb14eadaaf2cb765636b3ae04dad (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
use clap::Parser;

#[rustfmt::skip]
use statix::{
    config::{Opts, SubCommand},
    err::StatixErr,
    lint, fix, explain, dump, list,
};

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),
        SubCommand::Dump(_) => dump::main::main(),
        SubCommand::List(_) => list::main::main(),
    }
}

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