wash_cli/common/
update_cmd.rs1use anyhow::Result;
2
3use wash_lib::cli::{
4 update::{handle_update_component, UpdateCommand},
5 CommandOutput, OutputKind,
6};
7
8use crate::appearance::spinner::Spinner;
9
10pub async fn handle_command(
11 command: UpdateCommand,
12 output_kind: OutputKind,
13) -> Result<CommandOutput> {
14 let sp: Spinner = Spinner::new(&output_kind)?;
15 let out = match command {
16 UpdateCommand::Component(cmd) => {
17 sp.update_spinner_message(format!(
18 " Updating Component {} to {} ... ",
19 cmd.component_id, cmd.new_component_ref
20 ));
21
22 handle_update_component(cmd).await?
23 }
24 };
25
26 sp.finish_and_clear();
27
28 Ok(out)
29}