mod config; use clap::Parser; use crate::config::Config; #[derive(Parser, Debug)] #[command(version, about, long_about = None)] struct Args { /// Path to the config file. If blank, searches default config locations. #[arg(short = 'c', long = "config", default_value = "")] config_file: String, } fn main() { let args = Args::parse(); let _config = match args.config_file.as_str() { "" => Config::find_config().unwrap_or_else(|| panic!("Failed to find config. Paths searched: {:#?}", config::default_config_file_locations())), path => Config::parse_config_file_at_path(&path).unwrap_or_else(|err| panic!("Failed to parse config at {}. Error: {}", path, err)), }; println!("Found config file."); }