use std::path::PathBuf;
#[derive(Debug, Clone)]
pub enum Effect {
GitStage { path: PathBuf },
GitUnstage { path: PathBuf },
GitStageAll,
GitUnstageAll,
GitCommit {
message: String,
amend: bool,
author_name: Option<String>,
author_email: Option<String>,
},
GitPush { force_with_lease: bool },
GitPull { rebase: bool },
GitFetch,
GitCheckout { branch: String },
GitCreateBranch { name: String, start_point: Option<String> },
GitDeleteBranch { name: String, force: bool },
GitRebaseStart {
base: String,
use_root: bool,
todo_content: String,
},
GitRebaseContinue {
message: Option<String>,
author_name: Option<String>,
author_email: Option<String>,
},
GitRebaseAbort,
GitRebaseSkip,
GitCherryPick { hash: String },
GitRevert { hash: String },
GitReset { target: String, mode: ResetMode },
GitStash { message: Option<String> },
GitStashPop { index: usize },
GitStashDrop { stash_ref: String },
RefreshStatus,
RefreshLog,
RefreshBranches,
RefreshStashes,
RefreshAll,
ComputeDiff { path: PathBuf, staged: bool },
OpenInEditor { path: PathBuf },
SaveConfig { key: String, value: String },
ExecuteCustomCommand { name: String, command: String },
Batch(Vec<Effect>),
None,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum ResetMode {
Soft,
Mixed,
Hard,
}
impl Effect {
pub fn batch(effects: Vec<Effect>) -> Self {
Effect::Batch(effects)
}
pub fn is_none(&self) -> bool {
matches!(self, Effect::None)
}
}