dev_scripts/
main.rs

1//! The `dev-scripts` CLI tool.
2
3use anyhow::{Context, Result};
4use clap::Parser;
5use cli::Cli;
6use log::LevelFilter;
7use simplelog::{Config, SimpleLogger};
8
9use crate::commands::{compare_source_info, test_files};
10
11mod cli;
12mod cmd;
13mod commands;
14pub mod sync;
15pub mod testing;
16mod ui;
17
18fn main() -> Result<()> {
19    // Parse commandline options.
20    let args = Cli::parse();
21
22    // Init and set the verbosity level of the logger.
23    let level = match args.verbose {
24        0 => LevelFilter::Info,
25        1 => LevelFilter::Debug,
26        _ => LevelFilter::Trace,
27    };
28    SimpleLogger::init(level, Config::default()).context("Failed to initialize simple logger")?;
29
30    match args.cmd {
31        cli::Command::TestFiles { cmd } => test_files(cmd)?,
32        cli::Command::CompareSrcinfo {
33            pkgbuild_path,
34            srcinfo_path,
35        } => compare_source_info(pkgbuild_path, srcinfo_path)?,
36    }
37
38    Ok(())
39}