Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: log if file isn't found #144

Merged
merged 1 commit into from
Apr 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading