From c84b26b2ec18d3211043905e2bba5ffff2ac2ce9 Mon Sep 17 00:00:00 2001 From: Klesti Selimaj Date: Fri, 24 Jul 2026 18:02:26 +0200 Subject: [PATCH] Config reload command --- src/engine/engine.rs | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/engine/engine.rs b/src/engine/engine.rs index 3581add..0aa96c7 100644 --- a/src/engine/engine.rs +++ b/src/engine/engine.rs @@ -65,8 +65,28 @@ impl Engine { } } - pub async fn execute_command(&self, command: &str, _args: Vec<&str>) -> tokio::io::Result<()> { + pub async fn execute_command(&self, command: &str, args: Vec<&str>) -> tokio::io::Result<()> { match command { + "config" => { + const MESSAGE: &str = "Invalid command arguments, usage: config "; + + if args.len() != 1 { + self.terminal_server.error("config", MESSAGE).await?; + + return Ok(()); + } + + match args[0] { + "reload" => { + *self.config.lock().await = Config::new().await?; + } + + _ => { + self.terminal_server.error("config", MESSAGE).await?; + } + } + } + _ => { self.terminal_server .error(