use std::fmt;
#[derive(Clone, Copy, Debug, Default)]
pub enum ExecutionMode {
#[default]
Execute,
DryRun,
}
#[derive(Clone, Copy, Debug, Default)]
pub enum PullMode {
#[default]
Enabled,
Disabled,
}
#[derive(Clone, Copy, Debug, Default)]
pub enum PushMode {
#[default]
Enabled,
Disabled,
}
#[derive(Clone, Copy, Debug, Default)]
pub enum StashMode {
#[default]
Disabled,
Auto,
}
#[derive(Debug, Clone, Copy)]
pub enum BlockingState {
Rebase,
Merge,
Conflicts,
}
impl fmt::Display for BlockingState {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::Rebase => write!(f, "Rebase"),
Self::Merge => write!(f, "Merge"),
Self::Conflicts => write!(f, "Merge conflicts"),
}
}
}
#[derive(Debug, Default)]
pub struct RepoStatus {
pub staged: Vec<String>,
pub unstaged: Vec<String>,
pub untracked: Vec<String>,
}
impl RepoStatus {
pub const fn has_staged(&self) -> bool {
!self.staged.is_empty()
}
pub const fn has_unstaged(&self) -> bool {
!self.unstaged.is_empty()
}
pub const fn has_untracked(&self) -> bool {
!self.untracked.is_empty()
}
pub const fn has_any_changes(&self) -> bool {
self.has_staged() || self.has_unstaged() || self.has_untracked()
}
pub const fn total_files(&self) -> usize {
self.staged.len() + self.unstaged.len() + self.untracked.len()
}
}
#[derive(Debug)]
pub struct WorkflowConfig<'a> {
pub message: &'a str,
pub branch: &'a str,
pub upstream: &'a str,
pub pull_mode: PullMode,
pub push_mode: PushMode,
pub stash_mode: StashMode,
}
#[derive(Debug, Default)]
#[allow(clippy::struct_excessive_bools)]
pub struct Summary {
pub files_staged: usize,
pub commits_created: usize,
pub commits_pulled: usize,
pub pushed: bool,
pub stashed: bool,
pub skipped_stage: bool,
pub skipped_commit: bool,
pub skipped_pull: bool,
pub skipped_push: bool,
}