Skip to main content

git_stk/commands/
upgrade.rs

1use anyhow::Result;
2use clap::ArgAction;
3
4use crate::commands::Run;
5
6/// Upgrade git-stk to the latest release.
7#[derive(Debug, clap::Args)]
8pub struct Upgrade {
9    /// Build and install the latest unreleased commit instead.
10    #[arg(long, action = ArgAction::SetTrue, conflicts_with = "force")]
11    head: bool,
12    /// Reinstall the latest release even when already up to date.
13    #[arg(long, action = ArgAction::SetTrue)]
14    force: bool,
15    /// Skip the --head confirmation prompt.
16    #[arg(long, short = 'y', action = ArgAction::SetTrue, requires = "head")]
17    yes: bool,
18}
19
20impl Run for Upgrade {
21    fn run(self) -> Result<()> {
22        crate::upgrade::upgrade(self.head, self.force, self.yes)
23    }
24}