git_stk/commands/
restack.rs1use anyhow::Result;
2use clap::ArgAction;
3
4use crate::cli::{PushMode, UpdateRefsMode};
5use crate::commands::Run;
6
7#[derive(Debug, clap::Args)]
10pub struct Restack {
11 #[arg(long, action = ArgAction::SetTrue, conflicts_with = "no_update_refs")]
13 update_refs: bool,
14 #[arg(long, action = ArgAction::SetTrue)]
16 no_update_refs: bool,
17 #[arg(long, action = ArgAction::SetTrue, conflicts_with = "no_push")]
19 push: bool,
20 #[arg(long, action = ArgAction::SetTrue)]
22 no_push: bool,
23}
24
25impl Run for Restack {
26 fn run(self) -> Result<()> {
27 crate::stack::restack(
28 UpdateRefsMode::from_flags(self.update_refs, self.no_update_refs),
29 PushMode::from_flags(self.push, self.no_push),
30 )
31 }
32}
33
34#[derive(Debug, clap::Args)]
36pub struct Continue {}
37
38impl Run for Continue {
39 fn run(self) -> Result<()> {
40 crate::stack::continue_restack()
41 }
42}
43
44#[derive(Debug, clap::Args)]
46pub struct Abort {}
47
48impl Run for Abort {
49 fn run(self) -> Result<()> {
50 crate::stack::abort_restack()
51 }
52}