blob: b4452857962390128a0efb52abbc1868a2029fe9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
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.");
}
|