compiled without error, needs fix for warnings and testing
This commit is contained in:
@@ -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" => {
|
||||
|
||||
@@ -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<dyn std::error::Error>> {
|
||||
match action {
|
||||
"quit" => self.handle_quit(terminal).await,
|
||||
|
||||
@@ -15,7 +15,7 @@ pub async fn run_ui() -> Result<(), Box<dyn std::error::Error>> {
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user