rush_sync_server/commands/history/
history.rs

1// =====================================================
2// COMMAND IMPLEMENTATIONS - TRAIT ADOPTION
3// =====================================================
4
5// =====================================================
6// FILE: commands/history/history.rs - TRAIT IMPL
7// =====================================================
8
9use crate::commands::command::Command;
10use crate::core::prelude::*;
11
12#[derive(Debug)]
13pub struct HistoryCommand;
14
15impl Command for HistoryCommand {
16    fn name(&self) -> &'static str {
17        "history"
18    }
19
20    fn description(&self) -> &'static str {
21        "Manage command history"
22    }
23
24    fn matches(&self, command: &str) -> bool {
25        command.trim().starts_with("history")
26    }
27
28    fn execute_sync(&self, args: &[&str]) -> Result<String> {
29        match args.first() {
30            Some(&"-c" | &"--clear") => Ok("__CLEAR_HISTORY__".to_string()),
31            Some(&"-h" | &"--help") => Ok(get_translation("system.commands.history.help", &[])),
32            _ => Ok(get_translation("system.commands.history.unknown", &[])),
33        }
34    }
35
36    fn priority(&self) -> u8 {
37        60 // Höhere Priorität für häufig genutzte Commands
38    }
39}