pub trait Command {
type Input;
type Output;
// Required methods
fn execute(&self, input: Self::Input) -> Result<Self::Output>;
fn name(&self) -> &'static str;
fn description(&self) -> &'static str;
// Provided methods
fn requires_git_repo(&self) -> bool { ... }
fn is_destructive(&self) -> bool { ... }
}
Expand description
Trait for all git-x commands
This trait provides a unified interface for all git-x commands, allowing for consistent error handling, testing, and potential plugin architecture.
Required Associated Types§
Required Methods§
Sourcefn execute(&self, input: Self::Input) -> Result<Self::Output>
fn execute(&self, input: Self::Input) -> Result<Self::Output>
Execute the command with the given input
Sourcefn description(&self) -> &'static str
fn description(&self) -> &'static str
Get a description of what this command does
Provided Methods§
Sourcefn requires_git_repo(&self) -> bool
fn requires_git_repo(&self) -> bool
Whether this command requires a git repository to function
Sourcefn is_destructive(&self) -> bool
fn is_destructive(&self) -> bool
Whether this command performs destructive operations