use apt_mirror_check::{check_mirror_guessed, log_config};
use clap::Parser;
use std::path::PathBuf;
#[derive(Parser, Debug)]
#[clap(
author,
version,
about,
long_about = r#"Check errors for apt-mirror
apt-mirror is a tool to create a debian/ubuntu mirror locally.
It's a good tool, but sometimes we get corrupted packages.
apt-mirror-check is aimed at revealing this kind of error early."#
)]
struct Args {
#[clap(long, short)]
base_dir: Option<PathBuf>,
#[clap(short, long)]
num_worker: Option<usize>,
#[clap(long)]
delete: bool,
#[clap(short, long, action = clap::ArgAction::Count)]
verbose: u8,
}
fn main() {
let args = Args::parse();
log_config::init(args.verbose);
rayon::ThreadPoolBuilder::new()
.num_threads(
args.num_worker
.unwrap_or_else(|| std::thread::available_parallelism().unwrap().get() * 2),
)
.build_global()
.unwrap();
check_mirror_guessed(args.base_dir, args.delete);
}