Command processing
This commit is contained in:
+2
-14
@@ -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),
|
||||
});
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user