Skip to content

Commit

Permalink
feat: log if file isn't found
Browse files Browse the repository at this point in the history
  • Loading branch information
hougesen committed Apr 1, 2024
1 parent 6a8551b commit 3c8179d
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ fn format_command(args: FormatCommandArguments) -> Result<(), MdsfError> {

if args.path.is_file() {
handle_file(&conf, &args.path)?;
} else {
} else if args.path.is_dir() {
for entry in ignore::WalkBuilder::new(args.path)
.git_ignore(true)
.require_git(false)
Expand All @@ -27,6 +27,21 @@ fn format_command(args: FormatCommandArguments) -> Result<(), MdsfError> {
handle_file(&conf, file_path)?;
}
}
} else {
#[cfg(target_os = "windows")]
let pre = "";
#[cfg(not(target_os = "windows"))]
let pre = "\u{1b}[31m";

#[cfg(target_os = "windows")]
let post = "";
#[cfg(not(target_os = "windows"))]
let post = "\u{1b}[0m";

println!(
"{pre}No file or directory with the name \"{}\" found{post}",
args.path.display(),
);
}

Ok(())
Expand Down

0 comments on commit 3c8179d

Please sign in to comment.