rush_sync_server/commands/test/
command.rs

1// =====================================================
2// FILE: src/commands/test/command.rs
3// =====================================================
4use crate::commands::command::Command;
5use crate::core::prelude::*;
6
7#[derive(Debug)]
8pub struct TestCommand;
9
10impl Command for TestCommand {
11    fn name(&self) -> &'static str {
12        "test"
13    }
14
15    fn description(&self) -> &'static str {
16        "Test command for debugging output"
17    }
18
19    fn matches(&self, command: &str) -> bool {
20        command.trim().to_lowercase().starts_with("test")
21    }
22
23    fn execute_sync(&self, args: &[&str]) -> Result<String> {
24        match args.first() {
25            None => {
26                // βœ… EINFACHER EINZEILIGER TEST
27                Ok("πŸ”₯ TEST: Einzeiliger Text funktioniert!".to_string())
28            }
29            Some(&"multi") => {
30                // βœ… MEHRZEILIGER TEST
31                Ok(format!(
32                    "πŸ”₯ TEST: Mehrzeiliger Text:\nZeile 1\nZeile 2\nZeile 3"
33                ))
34            }
35            Some(&"long") => {
36                // βœ… LANGER TEXT TEST
37                Ok(format!(
38                    "πŸ”₯ TEST: Sehr langer Text: Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."
39                ))
40            }
41            Some(&"format") => {
42                // βœ… FORMAT TEST (wie bei theme help)
43                Ok(format!(
44                    "πŸ”₯ TEST Format:\n\
45                    Line 1: Hello World\n\
46                    Line 2: This is a test\n\
47                    Line 3: With multiple lines"
48                ))
49            }
50            Some(&"emoji") => {
51                // βœ… EMOJI TEST
52                Ok("🎨πŸ”₯βœ…πŸŽ―πŸš€ Emoji Test funktioniert! πŸŽ‰".to_string())
53            }
54            Some(&"theme") => {
55                // βœ… THEME DEBUG TEST
56                Ok("πŸ”₯ TEST: Theme-Command wird aufgerufen - das funktioniert!".to_string())
57            }
58            Some(&"theme-help") => {
59                // βœ… NACHBAU DES THEME HELP
60                Ok(format!(
61                    "🎨 TEST Theme Help:\nLine 1: theme\nLine 2: theme <name>\nLine 3: theme -h"
62                ))
63            }
64            _ => Ok(
65                "πŸ”₯ TEST Optionen: test, test multi, test long, test format, test emoji"
66                    .to_string(),
67            ),
68        }
69    }
70
71    fn priority(&self) -> u8 {
72        10 // Niedrige PrioritΓ€t fΓΌr Test-Command
73    }
74
75    fn is_available(&self) -> bool {
76        cfg!(debug_assertions) // Nur in Debug-builds
77    }
78}