Skip to main content

zoi_cli/cmd/
upgrade.rs

1//! Logic for the `upgrade` command.
2
3use anyhow::Result;
4use colored::Colorize;
5
6use crate::pkg;
7
8/// Run the upgrade command.
9///
10/// # Errors
11///
12/// Returns an error if the upgrade fails.
13pub fn run(
14    branch: &str,
15    status: &str,
16    number: &str,
17    force: bool,
18    tag: Option<String>,
19    custom_branch: Option<String>
20) -> Result<()> {
21    println!("{} Upgrading Zoi...", "::".bold().blue());
22
23    match pkg::upgrade::run(branch, status, number, force, tag, custom_branch) {
24        Ok(()) => {}
25        Err(e) if e.to_string() == "already_on_latest" => {}
26        Err(e) => return Err(e)
27    }
28    Ok(())
29}