cargo: fmt

This commit is contained in:
Muhammad Nauman Raza 2024-03-22 21:13:30 +00:00
parent c456994260
commit 7776220e06
Signed by: devraza
GPG key ID: 91EAD6081011574B

View file

@ -1,6 +1,6 @@
use std::{fs, path, process};
use clap::Parser;
use colored::Colorize;
use std::{fs, path, process};
#[derive(Parser, Debug)]
#[command(version, about, long_about = None, author)]
@ -19,7 +19,10 @@ fn main() -> std::io::Result<()> {
if args.targets.is_empty() {
println!("{} no arguments passed", "error:".red().bold());
println!("{} try 'vpr -h' for more information", "note:".cyan().bold());
println!(
"{} try 'vpr -h' for more information",
"note:".cyan().bold()
);
process::exit(0);
}
@ -28,7 +31,7 @@ fn main() -> std::io::Result<()> {
println!("{} you're trying to delete an important directory ({})! specify '{}' if you really want to do this", "error:".red().bold(), "--no-preserve".yellow(), target);
process::exit(0);
}
if path::Path::new(target).exists() {
if fs::metadata(target).unwrap().is_dir() {
let _ = fs::remove_dir_all(target);
@ -36,7 +39,11 @@ fn main() -> std::io::Result<()> {
let _ = fs::remove_file(target);
}
} else {
println!("{} the specified target does not exist {}", "error:".red().bold(), target.yellow());
println!(
"{} the specified target does not exist {}",
"error:".red().bold(),
target.yellow()
);
}
}