Working command system

This commit is contained in:
2026-07-15 22:32:49 +02:00
parent 278a660d5a
commit feb9166c30
3 changed files with 13 additions and 2 deletions
Generated
+1
View File
@@ -309,6 +309,7 @@ name = "pulse-trader"
version = "0.1.0-alpha.0"
dependencies = [
"chrono",
"crossterm",
"pulse-ui",
"tokio",
]
+1
View File
@@ -7,6 +7,7 @@ edition = "2024"
chrono = "0.4.45"
pulse-ui = { workspace = true }
tokio = { workspace = true, features = ["rt-multi-thread", "macros"] }
crossterm = { workspace = true }
[workspace]
members = ["pulse-ui"]
+12 -3
View File
@@ -1,3 +1,4 @@
pub mod command;
pub mod formatting;
pub mod types;
@@ -141,10 +142,18 @@ impl App for PulseTradeApp {
if let Some(event) = event.downcast_ref() {
if self.command.value.lock().await.handle_event(event) {
return;
}
}
} else if let crossterm::event::Event::Key(key) = event {
if key.code.is_enter() {
let mut command = self.command.lock().await;
let command_text = command.text.clone();
command.cursor = 0;
command.text.clear();
ctx.close().await;
drop(command);
self.execute_command(ctx, command_text.trim()).await;
}
}
}
}
async fn layout(&self) -> pulse_ui::layout::LayoutItem {