rush_sync_server/commands/history/
command.rs

1// =====================================================
2// FILE: src/commands/history/command.rs - VEREINFACHT
3// =====================================================
4
5use crate::commands::command::Command;
6use crate::core::prelude::*;
7
8#[derive(Debug)]
9pub struct HistoryCommand;
10
11impl Command for HistoryCommand {
12    fn name(&self) -> &'static str {
13        "history"
14    }
15
16    fn description(&self) -> &'static str {
17        "Manage command history"
18    }
19
20    fn matches(&self, command: &str) -> bool {
21        command.trim().starts_with("history")
22    }
23
24    fn execute_sync(&self, args: &[&str]) -> Result<String> {
25        match args.first() {
26            Some(&"-c" | &"--clear") => Ok("__CLEAR_HISTORY__".to_string()),
27            Some(&"-h" | &"--help") => Ok(format!(
28                "📁 History Commands:\n\
29                history        Show this help\n\
30                history -c     Clear history\n\
31                ↑ ↓           Navigate history\n\n\
32                File: ~/.rss/rush.history"
33            )),
34            _ => Ok("📁 Use ↑↓ arrows to navigate, 'history -c' to clear".to_string()),
35        }
36    }
37
38    fn priority(&self) -> u8 {
39        60
40    }
41}