Files
pulse-trader/src/terminal/command.rs
T
2026-07-23 01:42:03 +02:00

30 lines
758 B
Rust

use crate::PulseTradeApp;
impl PulseTradeApp {
pub async fn execute_command(&mut self, ctx: &pulse_ui::state::Context, command: &str) {
if command.is_empty() {
return;
}
match command.trim() {
"exit" | "quit" | "leave" => {
ctx.close().await;
}
_ => {
if let Err(e) = self
.sock
.as_mut()
.unwrap()
.send(pulse_wire::terminal::TerminalClientMessage::ExecuteCommand(
command.to_string(),
))
.await
{
eprintln!("{e}");
}
}
}
}
}