cargo: fmt
This commit is contained in:
parent
c456994260
commit
7776220e06
15
src/main.rs
15
src/main.rs
|
@ -1,6 +1,6 @@
|
||||||
use std::{fs, path, process};
|
|
||||||
use clap::Parser;
|
use clap::Parser;
|
||||||
use colored::Colorize;
|
use colored::Colorize;
|
||||||
|
use std::{fs, path, process};
|
||||||
|
|
||||||
#[derive(Parser, Debug)]
|
#[derive(Parser, Debug)]
|
||||||
#[command(version, about, long_about = None, author)]
|
#[command(version, about, long_about = None, author)]
|
||||||
|
@ -19,7 +19,10 @@ fn main() -> std::io::Result<()> {
|
||||||
|
|
||||||
if args.targets.is_empty() {
|
if args.targets.is_empty() {
|
||||||
println!("{} no arguments passed", "error:".red().bold());
|
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);
|
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);
|
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);
|
process::exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if path::Path::new(target).exists() {
|
if path::Path::new(target).exists() {
|
||||||
if fs::metadata(target).unwrap().is_dir() {
|
if fs::metadata(target).unwrap().is_dir() {
|
||||||
let _ = fs::remove_dir_all(target);
|
let _ = fs::remove_dir_all(target);
|
||||||
|
@ -36,7 +39,11 @@ fn main() -> std::io::Result<()> {
|
||||||
let _ = fs::remove_file(target);
|
let _ = fs::remove_file(target);
|
||||||
}
|
}
|
||||||
} else {
|
} 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()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue