Skip to main content

romm_cli/commands/
update.rs

1use crate::core::interrupt::InterruptContext;
2use crate::update::{self, ApplyUpdateOptions, ApplyUpdateOutcome};
3use anyhow::Result;
4
5/// Handle the `update` command.
6pub async fn handle(interrupt: Option<InterruptContext>) -> Result<()> {
7    let options = ApplyUpdateOptions {
8        show_progress: true,
9        show_output: true,
10        no_confirm: true,
11        target_version_tag: None,
12    };
13    match update::apply_update(interrupt, options).await? {
14        ApplyUpdateOutcome::Updated(version) => {
15            println!("Updated successfully to `{version}`.");
16            println!("Restart romm-cli to use the new version.");
17        }
18        ApplyUpdateOutcome::UpToDate(version) => {
19            println!("Already up to date (`{version}`).");
20        }
21    }
22    Ok(())
23}