aboutsummaryrefslogtreecommitdiff
path: root/bin/src/main.rs
blob: f5047968b8f14f470e5d36ca3fcb46544b39e506 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
use clap::Parser;
use statix::{
    config::{Opts, SubCommand},
    err::StatixErr,
    explain, fix, lint,
};

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);
    }
}