Trait Command

Source
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§

Source

type Input

The input type for this command (can be () for no input)

Source

type Output

The output type for this command

Required Methods§

Source

fn execute(&self, input: Self::Input) -> Result<Self::Output>

Execute the command with the given input

Source

fn name(&self) -> &'static str

Get the name of this command (for logging/debugging)

Source

fn description(&self) -> &'static str

Get a description of what this command does

Provided Methods§

Source

fn requires_git_repo(&self) -> bool

Whether this command requires a git repository to function

Source

fn is_destructive(&self) -> bool

Whether this command performs destructive operations

Implementors§