// src/main.rs mod cli; mod manip; use glob::glob; use manip::{Limit, LimitList, MergedLimitList}; fn main() -> std::io::Result<()> { env_logger::init(); // TODO add more logging // TODO utilize CLI // let _cli = cli::Cli::parse(); // TODO parse config file if one is provided let mut merged_list = MergedLimitList::new(); // Crawl /blocks for block lists -> glob pattern: "blocks/**/*.txt" { let mut blocklists = vec![]; let block_paths = glob("blocks/**/*.txt").expect("Bad glob pattern"); for path in block_paths.filter_map(|x| x.ok()) { blocklists.extend(LimitList::from_file(path)); // TODO Check if path contains trust value as part of filename when building limitlist } for list in blocklists { merged_list.add_limit_list(list, Limit::Block); } } // Crawl /silences for silence lists -> glob pattern: "mutes/**/*.txt" { let mut mutelists = vec![]; let mute_paths = glob("mutes/**/*.txt").expect("Bad glob pattern"); for path in mute_paths.filter_map(|x| x.ok()) { mutelists.extend(LimitList::from_file(path)); // TODO Check if path contains trust value as part of filename when building limitlist } for list in mutelists { merged_list.add_limit_list(list, Limit::Silence); } } merged_list.export_file("block.txt", "mute.txt", (50, 33)) }