serrf-cli 0.1.0

Command-line interface for SERRF metabolomics normalization
mod args;
mod commands;
mod output;

use args::{Args, Command};
use clap::Parser;
use tracing_subscriber::{EnvFilter, fmt};

fn main() {
    let args = Args::parse();

    let filter = match args.verbose {
        0 => "warn",
        1 => "info",
        _ => "debug",
    };
    fmt()
        .with_env_filter(EnvFilter::new(filter))
        .with_writer(std::io::stderr)
        .init();

    let result = match &args.command {
        Command::Normalize(n_args) => commands::normalize::run(n_args, args.quiet),
    };

    if let Err(e) = result {
        eprintln!("Error: {e:#}");
        std::process::exit(1);
    }
}