Skip to main content

git_stk/commands/
downgrade.rs

1use anyhow::Result;
2use clap::ArgAction;
3
4use crate::commands::Run;
5
6/// Step git-stk back to an earlier release.
7#[derive(Debug, clap::Args)]
8pub struct Downgrade {
9    /// Downgrade to this version instead of the release just before the
10    /// installed one. Must be older than the installed version and no older
11    /// than the earliest release `downgrade` can reach.
12    #[arg(long)]
13    to: Option<String>,
14    /// Skip the confirmation prompt.
15    #[arg(long, short = 'y', action = ArgAction::SetTrue)]
16    yes: bool,
17}
18
19impl Run for Downgrade {
20    fn run(self) -> Result<()> {
21        crate::upgrade::downgrade(self.to, self.yes)
22    }
23}