eazygit 0.5.1

A fast TUI for Git with staging, conflicts, rebase, and palette-first UX
Documentation
//! Reset-related command definitions.
//!
//! Commands for Git reset operations (soft, mixed, hard).

use  crate::palette::command::{CommandCategory, CommandDef, CommandId};
use crate::app::Action;

pub fn reset_commands() -> Vec<CommandDef> {
    vec![
        CommandDef {
            id: CommandId::ResetSoft,
            name: "Reset soft HEAD~1",
            key: "rs",
            category: CommandCategory::Reset,
            description: "Reset soft to HEAD~1",
            action_factory: |state| {
                if state.reset_pending.as_deref() == Some("--soft") {
                    Some(Action::ResetSoft)
                } else {
                    Some(Action::RequestResetSoft)
                }
            },
            is_enabled: |_| true,
            keywords: &["reset", "soft", "head"],
        },
        CommandDef {
            id: CommandId::ResetMixed,
            name: "Reset mixed HEAD~1",
            key: "rm",
            category: CommandCategory::Reset,
            description: "Reset mixed to HEAD~1",
            action_factory: |state| {
                if state.reset_pending.as_deref() == Some("--mixed") {
                    Some(Action::ResetMixed)
                } else {
                    Some(Action::RequestResetMixed)
                }
            },
            is_enabled: |_| true,
            keywords: &["reset", "mixed", "head"],
        },
        CommandDef {
            id: CommandId::ResetHard,
            name: "Reset hard HEAD~1",
            key: "rh",
            category: CommandCategory::Reset,
            description: "Reset hard to HEAD~1 (destructive)",
            action_factory: |state| {
                if state.reset_pending.as_deref() == Some("--hard") {
                    Some(Action::ResetHard)
                } else {
                    Some(Action::RequestResetHard)
                }
            },
            is_enabled: |_| true,
            keywords: &["reset", "hard", "head", "destructive"],
        },
    ]
}