rush_sync_server/commands/history/
command.rs1use 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") => {
28 Ok(get_command_translation("system.commands.history.help", &[]))
29 }
30 _ => Ok(get_command_translation(
31 "system.commands.history.usage",
32 &[],
33 )),
34 }
35 }
36
37 fn priority(&self) -> u8 {
38 60
39 }
40}