Strategy command
This commit is contained in:
@@ -1,10 +1,14 @@
|
||||
use crate::{engine::Engine, store::config::Config};
|
||||
|
||||
use pulse_sdk::terminal::{ItemState, Mode, StrategyStatus};
|
||||
use pulse_sdk::prelude::*;
|
||||
use toml::Value;
|
||||
|
||||
impl Engine {
|
||||
pub async fn execute_command(&self, command: &str, args: Vec<&str>) -> tokio::io::Result<()> {
|
||||
pub async fn execute_command(
|
||||
&self,
|
||||
command: &str,
|
||||
mut args: Vec<&str>,
|
||||
) -> tokio::io::Result<()> {
|
||||
match command {
|
||||
"config" | "cfg" => {
|
||||
if args.len() == 0 {
|
||||
@@ -43,7 +47,7 @@ impl Engine {
|
||||
.await?;
|
||||
}
|
||||
|
||||
"strategy" | "strat" | "str" | "sg" => {
|
||||
"strategy" | "strat" | "sg" => {
|
||||
set_cfg!(id, {
|
||||
let id: String = id;
|
||||
|
||||
@@ -166,6 +170,19 @@ impl Engine {
|
||||
}
|
||||
}
|
||||
|
||||
"strategy" | "strat" | "sg" => {
|
||||
let Some(strategy_command) = args.drain(0..=0).next() else {
|
||||
return self.invalid_command_usage("strategy").await;
|
||||
};
|
||||
|
||||
self.strategy_engine
|
||||
.send(&StrategyEngineMessage::Command {
|
||||
command: strategy_command.to_owned(),
|
||||
args: args.into_iter().map(Into::into).collect(),
|
||||
})
|
||||
.await?;
|
||||
}
|
||||
|
||||
_ => {
|
||||
self.terminal_server
|
||||
.error(
|
||||
|
||||
Reference in New Issue
Block a user