eazygit 0.5.1

A fast TUI for Git with staging, conflicts, rebase, and palette-first UX
Documentation
//! Status reducer organized by functionality.
//!
//! This module contains all status-related reducer logic, split into focused
//! sub-modules for better organization and maintainability.
//!
//! **Module Organization:**
//! - `navigation.rs` - Navigation actions
//! - `selection.rs` - Selection actions
//! - `status_updates.rs` - Status data updates
//! - `reset.rs` - Reset confirmation actions
//! - `staging.rs` - Staging/unstaging actions
//! - `rebase_todo.rs` - Rebase TODO interactions
//! - `merge.rs` - Op log and merge status
//! - `remote.rs` - Remote interactions (push, prune, fetch)
//! - `pr.rs` - PR helper interactions
//! - `conflicts.rs` - Conflict resolution
//! - `general.rs` - General status actions

mod navigation;
mod selection;
mod status_updates;
mod reset;
mod staging;
mod rebase_todo;
mod merge;
mod remote;
mod pr;
mod conflicts;
mod general;

use crate::app::{actions::Action, state::AppState};

/// Main reducer function that delegates to specialized handlers.
pub fn reduce(mut state: AppState, action: &Action) -> Option<AppState> {
    // Try each specialized handler in order
    if navigation::handle_navigation(&mut state, action) {
        return Some(state);
    }
    if selection::handle_selection(&mut state, action) {
        return Some(state);
    }
    if status_updates::handle_status_updates(&mut state, action) {
        return Some(state);
    }
    if reset::handle_reset(&mut state, action) {
        return Some(state);
    }
    if staging::handle_staging(&mut state, action) {
        return Some(state);
    }
    
    // New granular handlers
    if rebase_todo::handle(&mut state, action) {
        return Some(state);
    }
    if merge::handle(&mut state, action) {
        return Some(state);
    }
    if remote::handle(&mut state, action) {
        return Some(state);
    }
    if pr::handle(&mut state, action) {
        return Some(state);
    }
    if conflicts::handle(&mut state, action) {
        return Some(state);
    }
    if general::handle(&mut state, action) {
        return Some(state);
    }
    
    None
}