pub mod git_commands;
pub mod custom;
pub mod patch;
pub mod branch;
pub mod stash;
#[cfg(test)]
pub mod test_utils;
pub use git_commands::{
StageFilesCommand,
UnstageFilesCommand,
CommitCommand,
PushCommand,
CherryPickCommand,
RevertCommand,
RebaseSaveAndRunCommand,
RebaseContinueCommand,
RebaseSkipCommand,
RebaseAbortCommand,
RebaseResolveConflictsCommand,
RebaseAbortFromConflictCommand,
RebaseContinueInterruptedCommand,
RebaseAbortInterruptedCommand,
ResetCommand,
ListMergedBranchesCommand,
PruneMergedBranchesCommand,
RemotePruneCommand,
ShowRemoteUrlCommand,
SetRemoteSshCommand,
AutoFetchCommand,
PrListCommand,
PrCheckoutCommand,
PrOpenCommand,
LogBriefCommand,
LogStatsCommand,
PullCommand,
PullRebaseCommand,
PullMergeCommand,
FetchAllPruneCommand,
OpenInEditorCommand,
CheckMergeStatusCommand,
};
pub use patch::{
StageHunkCommand,
UnstageHunkCommand,
StageLinesCommand,
UnstageLinesCommand,
};
pub use branch::{CheckoutBranchCommand, MergeBranchCommand, RebaseBranchCommand, CreateBranchCommand};
pub use stash::{ApplyStashCommand, PopStashCommand, CreateStashCommand, DeleteStashCommand};
#[cfg(test)]
#[allow(unused_imports)]
pub use test_utils::*;
use crate::services::GitService;
use crate::app::AppState;
use crate::errors::CommandError;
pub trait Command: Send + Sync {
fn execute(
&self,
git: &GitService,
state: &AppState,
) -> Result<CommandResult, CommandError>;
}
#[derive(Debug)]
pub enum CommandResult {
StateUpdate(AppState),
#[allow(dead_code)]
AsyncTask(crate::app::state::AsyncTask),
#[allow(dead_code)]
NoOp,
}