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 #[arg(long, action = ArgAction::SetTrue)]
25 dry_run: bool,
26}
27
28impl Run for Restack {
29 fn run(self) -> Result<()> {
30 crate::stack::restack(
31 UpdateRefsMode::from_flags(self.update_refs, self.no_update_refs),
32 PushMode::from_flags(self.push, self.no_push),
33 self.dry_run,
34 )
35 }
36}
37
38#[derive(Debug, clap::Args)]
40pub struct Continue {}
41
42impl Run for Continue {
43 fn run(self) -> Result<()> {
44 crate::stack::continue_restack()
45 }
46}
47
48#[derive(Debug, clap::Args)]
50pub struct Abort {}
51
52impl Run for Abort {
53 fn run(self) -> Result<()> {
54 crate::stack::abort_restack()
55 }
56}