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 } => {