From 8dfec29202ea190f9393f91c687dd83fd60fa1ee Mon Sep 17 00:00:00 2001 From: filipriec Date: Fri, 21 Mar 2025 14:05:39 +0100 Subject: [PATCH] compiled without error, needs fix for warnings and testing --- client/src/modes/handlers/event.rs | 4 ++-- client/src/tui/terminal/commands.rs | 8 ++++---- client/src/ui/handlers/ui.rs | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/client/src/modes/handlers/event.rs b/client/src/modes/handlers/event.rs index bdfef9a..ead0306 100644 --- a/client/src/modes/handlers/event.rs +++ b/client/src/modes/handlers/event.rs @@ -66,11 +66,11 @@ impl EventHandler { return Ok((false, message)); }, "force_quit" => { - let (should_exit, message) = command_handler.handle_command("force_quit", terminal).await?; + let (should_exit, message) = command_handler.handle_command("force_quit", terminal, grpc_client).await?; return Ok((should_exit, message)); }, "save_and_quit" => { - let (should_exit, message) = command_handler.handle_command("save_and_quit", terminal).await?; + let (should_exit, message) = command_handler.handle_command("save_and_quit", terminal, grpc_client).await?; return Ok((should_exit, message)); }, "revert" => { diff --git a/client/src/tui/terminal/commands.rs b/client/src/tui/terminal/commands.rs index 6648ed2..d54760f 100644 --- a/client/src/tui/terminal/commands.rs +++ b/client/src/tui/terminal/commands.rs @@ -4,19 +4,19 @@ use crate::tui::terminal::core::TerminalCore; use crate::tui::terminal::grpc_client::GrpcClient; pub struct CommandHandler { - grpc_client: GrpcClient, is_saved: bool, } impl CommandHandler { - pub fn new(grpc_client: GrpcClient) -> Self { - Self { grpc_client, is_saved: false } + pub fn new() -> Self { + Self { is_saved: false } } pub async fn handle_command( &mut self, action: &str, - terminal: &mut TerminalCore + terminal: &mut TerminalCore, + grpc_client: &mut GrpcClient, ) -> Result<(bool, String), Box> { match action { "quit" => self.handle_quit(terminal).await, diff --git a/client/src/ui/handlers/ui.rs b/client/src/ui/handlers/ui.rs index 53ec9b1..5ae5398 100644 --- a/client/src/ui/handlers/ui.rs +++ b/client/src/ui/handlers/ui.rs @@ -15,7 +15,7 @@ pub async fn run_ui() -> Result<(), Box> { let config = Config::load()?; let mut terminal = TerminalCore::new()?; // Remove .await let mut grpc_client = GrpcClient::new().await?; - let mut command_handler = CommandHandler::new(grpc_client); + let mut command_handler = CommandHandler::new(); let theme = Theme::from_str(&config.colors.theme); // Fetch table structure at startup (one-time)