feat: eprintln! instead of println! with errors

This commit is contained in:
Muhammad Nauman Raza 2024-05-29 09:39:07 +01:00
parent f8233656e7
commit ceca84b2b3

View file

@ -47,8 +47,8 @@ fn vaporise() -> Result<()> {
let args = Args::parse(); let args = Args::parse();
if args.targets.is_empty() { if args.targets.is_empty() {
println!("{} no arguments passed", "error:".red().bold()); eprintln!("{} no arguments passed", "error:".red().bold());
println!( eprintln!(
"{} try 'vpr -h' for more information", "{} try 'vpr -h' for more information",
"note:".cyan().bold() "note:".cyan().bold()
); );
@ -78,7 +78,7 @@ fn vaporise() -> Result<()> {
.with_context(|| format!("could not remove file: {}", target.bold()))?; .with_context(|| format!("could not remove file: {}", target.bold()))?;
} }
} else { } else {
println!( eprintln!(
"{} the specified target does not exist: {}", "{} the specified target does not exist: {}",
"error:".red().bold(), "error:".red().bold(),
target.yellow() target.yellow()
@ -91,6 +91,6 @@ fn vaporise() -> Result<()> {
fn main() { fn main() {
if let Err(error) = vaporise() { if let Err(error) = vaporise() {
println!("{} {:?}", "error:".red().bold(), error); eprintln!("{} {:?}", "error:".red().bold(), error);
} }
} }