fix: check if there are no sources
Some checks failed
Build and Upload filesorters Binaries / Build for Linux (push) Has been cancelled

This commit is contained in:
Vladimir Rubin 2024-12-30 19:41:29 +02:00
parent 3f49891dc8
commit bffc4a6ab8
Signed by: vavakado
GPG key ID: CAB744727F36B524

View file

@ -49,16 +49,20 @@ fn main() {
filesorters::Config::create(&config_path).unwrap(); filesorters::Config::create(&config_path).unwrap();
} }
match filesorters::Config::parse(config_path) { match filesorters::Config::parse(config_path.clone()) {
Ok(parsed_config) => { Ok(parsed_config) => {
CONFIG.set(parsed_config).unwrap(); CONFIG.set(parsed_config).unwrap();
println!("Config file loaded successfully");
} }
Err(err) => { Err(err) => {
eprintln!("Error: {}", err); eprintln!("Error reading config: {}", err);
process::exit(1); process::exit(1);
} }
} }
if cfg!(debug_assertions) {
println!("config:{:#?}", CONFIG.get().unwrap())
}
{ {
let mut counter = 1; let mut counter = 1;
for alias in CONFIG.get().unwrap().sources.keys() { for alias in CONFIG.get().unwrap().sources.keys() {
@ -67,8 +71,12 @@ fn main() {
} }
} }
if cfg!(debug_assertions) { if CONFIG.get().unwrap().sources.is_empty() {
println!("config:{:#?}", CONFIG.get().unwrap()) println!(
"No sources found, please specify them in {}",
config_path.display()
);
process::exit(1);
} }
let mut actual_selection: Vec<String> = Vec::new(); let mut actual_selection: Vec<String> = Vec::new();