eazygit 0.5.1

A fast TUI for Git with staging, conflicts, rebase, and palette-first UX
Documentation
//! Auto-fetch command definitions.
//!
//! Commands for configuring and managing auto-fetch functionality.

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

pub fn autofetch_commands() -> Vec<CommandDef> {
    vec![
        CommandDef {
            id: CommandId::AutoFetchToggle,
            name: "Toggle auto-fetch",
            key: "af",
            category: CommandCategory::AutoFetch,
            description: "Toggle auto-fetch",
            action_factory: |_| Some(Action::ToggleAutoFetch),
            is_enabled: |_| true,
            keywords: &["auto", "fetch", "toggle"],
        },
        CommandDef {
            id: CommandId::AutoFetchInterval,
            name: "Set auto-fetch interval (seconds)",
            key: "afi",
            category: CommandCategory::AutoFetch,
            description: "Set auto-fetch interval in seconds",
            action_factory: |state| {
                let input = state.palette_input.trim();
                if let Ok(secs) = input.parse::<u64>() {
                    Some(Action::SetAutoFetchInterval(secs))
                } else {
                    None
                }
            },
            is_enabled: |_| true,
            keywords: &["auto", "fetch", "interval", "seconds"],
        },
        CommandDef {
            id: CommandId::AutoFetchRemote,
            name: "Set auto-fetch remote",
            key: "afr",
            category: CommandCategory::AutoFetch,
            description: "Set auto-fetch remote name",
            action_factory: |state| {
                let name = state.palette_input.trim().to_string();
                if !name.is_empty() {
                    Some(Action::SetAutoFetchRemote(name))
                } else {
                    None
                }
            },
            is_enabled: |_| true,
            keywords: &["auto", "fetch", "remote"],
        },
        CommandDef {
            id: CommandId::AutoFetchCheck,
            name: "Check auto-fetch now",
            key: "afc",
            category: CommandCategory::AutoFetch,
            description: "Manually trigger auto-fetch check",
            action_factory: |_| Some(Action::CheckAutoFetch),
            is_enabled: |_| true,
            keywords: &["auto", "fetch", "check", "now"],
        },
    ]
}