From e14d7d57bf822169ff3ec1b6ff7cbb41475099b8 Mon Sep 17 00:00:00 2001 From: daywalker90 Date: Sun, 25 Feb 2024 14:20:24 +0100 Subject: [PATCH] fix(core): always print install errors --- coffee_cmd/src/main.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/coffee_cmd/src/main.rs b/coffee_cmd/src/main.rs index d5708fa..6201e1d 100644 --- a/coffee_cmd/src/main.rs +++ b/coffee_cmd/src/main.rs @@ -26,15 +26,15 @@ 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())); + 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 } => {