compiled without error, needs fix for warnings and testing

This commit is contained in:
filipriec
2025-03-21 14:05:39 +01:00
parent 15d87e33e5
commit 8dfec29202
3 changed files with 7 additions and 7 deletions

View File

@@ -66,11 +66,11 @@ impl EventHandler {
return Ok((false, message)); return Ok((false, message));
}, },
"force_quit" => { "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)); return Ok((should_exit, message));
}, },
"save_and_quit" => { "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)); return Ok((should_exit, message));
}, },
"revert" => { "revert" => {

View File

@@ -4,19 +4,19 @@ use crate::tui::terminal::core::TerminalCore;
use crate::tui::terminal::grpc_client::GrpcClient; use crate::tui::terminal::grpc_client::GrpcClient;
pub struct CommandHandler { pub struct CommandHandler {
grpc_client: GrpcClient,
is_saved: bool, is_saved: bool,
} }
impl CommandHandler { impl CommandHandler {
pub fn new(grpc_client: GrpcClient) -> Self { pub fn new() -> Self {
Self { grpc_client, is_saved: false } Self { is_saved: false }
} }
pub async fn handle_command( pub async fn handle_command(
&mut self, &mut self,
action: &str, action: &str,
terminal: &mut TerminalCore terminal: &mut TerminalCore,
grpc_client: &mut GrpcClient,
) -> Result<(bool, String), Box<dyn std::error::Error>> { ) -> Result<(bool, String), Box<dyn std::error::Error>> {
match action { match action {
"quit" => self.handle_quit(terminal).await, "quit" => self.handle_quit(terminal).await,

View File

@@ -15,7 +15,7 @@ pub async fn run_ui() -> Result<(), Box<dyn std::error::Error>> {
let config = Config::load()?; let config = Config::load()?;
let mut terminal = TerminalCore::new()?; // Remove .await let mut terminal = TerminalCore::new()?; // Remove .await
let mut grpc_client = GrpcClient::new().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); let theme = Theme::from_str(&config.colors.theme);
// Fetch table structure at startup (one-time) // Fetch table structure at startup (one-time)