use anyhow::Result;
use clap::ArgAction;
use crate::cli::{PushMode, UpdateRefsMode};
use crate::commands::Run;
#[derive(Debug, clap::Args)]
pub struct Restack {
#[arg(long, action = ArgAction::SetTrue, conflicts_with = "no_update_refs")]
update_refs: bool,
#[arg(long, action = ArgAction::SetTrue)]
no_update_refs: bool,
#[arg(long, action = ArgAction::SetTrue, conflicts_with = "no_push")]
push: bool,
#[arg(long, action = ArgAction::SetTrue)]
no_push: bool,
}
impl Run for Restack {
fn run(self) -> Result<()> {
crate::stack::restack(
UpdateRefsMode::from_flags(self.update_refs, self.no_update_refs),
PushMode::from_flags(self.push, self.no_push),
)
}
}
#[derive(Debug, clap::Args)]
pub struct Continue {}
impl Run for Continue {
fn run(self) -> Result<()> {
crate::stack::continue_restack()
}
}
#[derive(Debug, clap::Args)]
pub struct Abort {}
impl Run for Abort {
fn run(self) -> Result<()> {
crate::stack::abort_restack()
}
}