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") => Ok("📁 History Commands:\n\
28 history Show this help\n\
29 history -c Clear history\n\
30 ↑ ↓ Navigate history\n\n\
31 File: ~/.rss/rush.history"
32 .to_string()), _ => Ok("📁 Use ↑↓ arrows to navigate, 'history -c' to clear".to_string()),
34 }
35 }
36
37 fn priority(&self) -> u8 {
38 60
39 }
40}