fix: check if there are no sources
Some checks failed
Build and Upload filesorters Binaries / Build for Linux (push) Has been cancelled
Some checks failed
Build and Upload filesorters Binaries / Build for Linux (push) Has been cancelled
This commit is contained in:
parent
3f49891dc8
commit
bffc4a6ab8
1 changed files with 13 additions and 5 deletions
18
src/main.rs
18
src/main.rs
|
@ -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();
|
||||||
|
|
Loading…
Reference in a new issue