Command processing

This commit is contained in:
2026-07-23 01:34:04 +02:00
parent d74d94af89
commit 8e83c5cd5b
4 changed files with 47 additions and 38 deletions
+2 -14
View File
@@ -6,24 +6,12 @@ impl PulseTradeApp {
return;
}
let (command, _args) = if let Some((command, args)) = command.split_once(" ") {
(command, args.split(" ").collect())
} else {
(command, Vec::new())
};
match command {
match command.trim() {
"exit" | "quit" | "leave" => {
ctx.close().await;
}
_ => {
self.logs.lock().await.push(pulse_wire::terminal::EventLog {
kind: pulse_wire::terminal::LogKind::Err,
name: "cmd".to_string(),
message: format!("Command '{}' not found", command),
});
}
_ => {}
}
}
}
+1 -3
View File
@@ -43,9 +43,7 @@ impl App for PulseTradeApp {
async fn update(&mut self, ctx: &pulse_ui::state::Context, event: Box<dyn Any + Send + Sync>) {
if let Some(Refresh) = event.downcast_ref() {
return;
}
if let Some(event) = event.downcast_ref() {
} else 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 {