From dbf2c9f4d7f022a5c5294ccf4d7e55b88a8802c7 Mon Sep 17 00:00:00 2001 From: daywalker90 Date: Sun, 25 Feb 2024 14:20:24 +0100 Subject: [PATCH] always print install errors --- coffee_cmd/src/main.rs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/coffee_cmd/src/main.rs b/coffee_cmd/src/main.rs index d5708fa..ac3a108 100644 --- a/coffee_cmd/src/main.rs +++ b/coffee_cmd/src/main.rs @@ -26,15 +26,17 @@ async fn run(args: CoffeeArgs, mut coffee: CoffeeManager) -> Result<(), CoffeeEr } else { None }; - let result = coffee.install(&plugin, verbose, dynamic).await; - if let Some(spinner) = spinner { - if result.is_ok() { - spinner.finish(); - } else { - spinner.failed(); + match coffee.install(&plugin, verbose, dynamic).await { + Ok(_) => { + spinner.and_then(|spinner| Some(spinner.finish())); + if verbose { + term::success!("Plugin {plugin} Compiled and Installed") + } + } + Err(err) => { + spinner.and_then(|spinner| Some(spinner.failed())); + term::error(format!("{err}")) } - } else if result.is_ok() { - term::success!("Plugin {plugin} Compiled and Installed") } } CoffeeCommand::Remove { plugin } => {