rush_sync_server/commands/exit/
command.rs

1// =====================================================
2// FILE: commands/exit/exit.rs - TRAIT IMPL
3// =====================================================
4
5use crate::commands::command::Command;
6use crate::core::prelude::*;
7use crate::i18n::get_command_translation;
8
9#[derive(Debug)]
10pub struct ExitCommand;
11
12impl Command for ExitCommand {
13    fn name(&self) -> &'static str {
14        "exit"
15    }
16
17    fn description(&self) -> &'static str {
18        "Exit the application"
19    }
20
21    fn matches(&self, command: &str) -> bool {
22        crate::matches_exact!(command, "exit" | "q")
23    }
24
25    fn execute_sync(&self, _args: &[&str]) -> Result<String> {
26        let msg = get_command_translation("system.input.confirm_exit", &[]);
27        Ok(format!("__CONFIRM_EXIT__{}", msg))
28    }
29
30    fn priority(&self) -> u8 {
31        100 // Höchste Priorität für Exit
32    }
33}