zoi/cmd/
upgrade.rs

1use crate::pkg;
2use anyhow::Result;
3use colored::*;
4
5pub fn run(
6    branch: &str,
7    status: &str,
8    number: &str,
9    force: bool,
10    tag: Option<String>,
11    custom_branch: Option<String>,
12) -> Result<()> {
13    println!("{}", "--- Upgrading Zoi ---".yellow());
14
15    match pkg::upgrade::run(branch, status, number, force, tag, custom_branch) {
16        Ok(()) => {
17            println!(
18                "\n{}",
19                "Zoi upgraded successfully! Please restart your shell for changes to take effect."
20                    .green()
21            );
22            println!(
23                "\n{}: https://github.com/Zillowe/Zoi/blob/main/CHANGELOG.md",
24                "Changelog".cyan().bold()
25            );
26            println!(
27                "\n{}: To update shell completions, run 'zoi shell <your-shell>'.",
28                "Hint".cyan().bold()
29            );
30        }
31        Err(e) if e.to_string() == "already_on_latest" => {}
32        Err(e) => return Err(e),
33    }
34    Ok(())
35}