Skip to content

Commit

Permalink
handle missing dir
Browse files Browse the repository at this point in the history
  • Loading branch information
Ramilito committed Dec 3, 2023
1 parent d3471fa commit ebc7b42
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,14 @@ mod print;
mod processor;
mod settings;

use std::sync::{Arc, Mutex};
use std::{
path::Path,
sync::{Arc, Mutex},
};

use crate::{enums::LogLevel, logger::Logger, processor::Process, settings::Settings};
use clap::Parser;
use colored::Colorize;

#[derive(Debug, Parser)]
#[clap(author, version, about, long_about = None)]
Expand All @@ -31,7 +35,16 @@ fn main() -> anyhow::Result<()> {
let targets = Process::get_entries(args, settings);

for target in targets {
Process::process_target(&logger, &target)?;
if Path::new(&target).exists() {
Process::process_target(&logger, &target)?;
} else {
let message = "Must build at directory: not a valid directory ⚠️".yellow().to_string();
logger.lock().unwrap().log_warning(format!(
"{}:{}",
message,
&target
))
}
}

Ok(())
Expand Down

0 comments on commit ebc7b42

Please sign in to comment.