romm_cli/commands/
update.rs1use anyhow::Result;
2use self_update::cargo_crate_version;
3
4fn github_release_asset_key() -> &'static str {
7 match (std::env::consts::OS, std::env::consts::ARCH) {
8 ("macos", "x86_64") => "macos-x86_64",
9 ("macos", "aarch64") => "macos-aarch64",
10 ("linux", "x86_64") => "linux-x86_64",
11 ("linux", "aarch64") => "linux-aarch64",
12 ("windows", "x86_64") => "windows-x86_64",
13 _ => self_update::get_target(),
14 }
15}
16
17pub fn handle() -> Result<()> {
19 let status = self_update::backends::github::Update::configure()
20 .repo_owner("patricksmill")
21 .repo_name("romm-cli")
22 .bin_name("romm-cli")
23 .target(github_release_asset_key())
24 .show_download_progress(true)
25 .current_version(cargo_crate_version!())
26 .build()?
27 .update()?;
28
29 println!("Update status: `{}`!", status.version());
30 Ok(())
31}