aboutsummaryrefslogtreecommitdiff
path: root/bin/src/main.rs
blob: be79bb82ce0d84bc6f897c2bb0ec9f3cf52899fa (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
use clap::Parser;
use statix::{
    config::{Opts, SubCommand},
    dump,
    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),
        SubCommand::Dump(_) => dump::main::main(),
    }
}

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