deepseek_rust_cli/
updater.rs1use anyhow::Result;
2use self_update::backends::github::Update;
3
4use crate::version::VERSION;
5
6fn get_short_target() -> String {
8 let os = std::env::consts::OS; let arch = std::env::consts::ARCH; let arch_short = match arch {
13 "x86_64" | "amd64" => "x86_64",
14 "aarch64" | "arm64" => "aarch64",
15 _ => arch,
16 };
17
18 format!("{}-{}", os, arch_short)
19}
20
21pub fn run_update() -> Result<String> {
23 let target = get_short_target();
24
25 let status = Update::configure()
26 .repo_owner("mahirgul")
27 .repo_name("deepseek-rust-cli")
28 .bin_name("deepseek-rust-cli")
29 .target(&target)
30 .show_download_progress(false)
31 .show_output(false)
32 .current_version(VERSION)
33 .no_confirm(true)
34 .build()?
35 .update()?;
36
37 if status.updated() {
38 Ok(format!(
39 "✅ Successfully updated to version {}! Please restart the application.",
40 status.version()
41 ))
42 } else {
43 Ok(format!(
44 "ℹ️ You are already using the latest version ({}).",
45 VERSION
46 ))
47 }
48}