small error to fix

This commit is contained in:
filipriec
2025-03-24 17:14:12 +01:00
parent 65ff1256aa
commit e6851e1fe4
7 changed files with 23 additions and 10 deletions

View File

@@ -0,0 +1,5 @@
// src/tui/controls.rs
pub mod commands;
pub use commands::*;

View File

@@ -1,5 +1,4 @@
// src/tui/terminal/commands.rs
// src/tui/controls/commands.rs
use crate::tui::terminal::core::TerminalCore;
pub struct CommandHandler {
@@ -24,7 +23,10 @@ impl CommandHandler {
}
}
async fn handle_quit(&self, terminal: &mut TerminalCore) -> Result<(bool, String), Box<dyn std::error::Error>> {
async fn handle_quit(
&self,
terminal: &mut TerminalCore,
) -> Result<(bool, String), Box<dyn std::error::Error>> {
if self.is_saved {
terminal.cleanup()?;
Ok((true, "Exiting.".into()))
@@ -33,12 +35,18 @@ impl CommandHandler {
}
}
async fn handle_force_quit(&self, terminal: &mut TerminalCore) -> Result<(bool, String), Box<dyn std::error::Error>> {
async fn handle_force_quit(
&self,
terminal: &mut TerminalCore,
) -> Result<(bool, String), Box<dyn std::error::Error>> {
terminal.cleanup()?;
Ok((true, "Force exiting without saving.".into()))
}
async fn handle_save_quit(&mut self, terminal: &mut TerminalCore) -> Result<(bool, String), Box<dyn std::error::Error>> {
async fn handle_save_quit(
&mut self,
terminal: &mut TerminalCore,
) -> Result<(bool, String), Box<dyn std::error::Error>> {
self.is_saved = true;
terminal.cleanup()?;
Ok((true, "State saved. Exiting.".into()))

View File

@@ -1,2 +1,4 @@
// src/tui/mod.rs
pub mod terminal;
pub mod controls;

View File

@@ -2,10 +2,8 @@
pub mod core;
pub mod grpc_client;
pub mod commands;
pub mod event_reader;
pub use core::TerminalCore;
pub use grpc_client::GrpcClient;
pub use commands::CommandHandler;
pub use event_reader::EventReader;