feat: fixed falure send & added print flag to engine-override

This commit is contained in:
Byson94
2025-09-29 12:38:37 +05:30
parent dc04096587
commit 38222328c2
3 changed files with 25 additions and 15 deletions

View File

@@ -23,6 +23,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/).
- Logs not truncating if it is over 100MB and not deleting if over 7 days old.
- Ewwii crashing on invalid duration property.
- The module resolver throwing error at `import` defenition.
- Fixed commands sending error with success status.
### Removed

View File

@@ -90,6 +90,7 @@ pub enum DaemonCommand {
},
EngineOverride {
config: String,
print: bool,
sender: DaemonResponseSender,
},
}
@@ -329,25 +330,28 @@ impl<B: DisplayBackend> App<B> {
}
}
DaemonCommand::TriggerUpdateUI { inject_vars, should_preserve_state, sender } => {
let output = match self.trigger_ui_update_with(inject_vars, should_preserve_state) {
Ok(_) => String::new(),
Err(e) => e.to_string(),
match self.trigger_ui_update_with(inject_vars, should_preserve_state) {
Ok(_) => sender.send_success(String::new())?,
Err(e) => sender.send_failure(e.to_string())?,
};
sender.send_success(output)?
}
DaemonCommand::CallRhaiFns { calls, sender } => {
let output = match self.call_rhai_fns(calls) {
Ok(_) => String::new(),
Err(e) => e.to_string(),
match self.call_rhai_fns(calls) {
Ok(_) => sender.send_success(String::new())?,
Err(e) => sender.send_failure(e.to_string())?,
};
sender.send_success(output)?
}
DaemonCommand::EngineOverride { config, sender } => {
let output = match self.set_engine_overrides(config) {
Ok(_) => String::new(),
Err(e) => e.to_string(),
DaemonCommand::EngineOverride { config, print, sender } => {
match self.set_engine_overrides(config) {
Ok(_) => {
if print {
sender.send_success(format!("{:#?}", self.rt_engine_config))?
} else {
sender.send_success(String::new())?
}
}
Err(e) => sender.send_failure(e.to_string())?,
};
sender.send_success(output)?
}
}
Ok(())

View File

@@ -191,7 +191,7 @@ pub enum ActionWithServer {
///
/// Format: --inject foo="val1" baz="val2"
/// Only variables used by the widget tree will affect the UI.
#[arg(long = "inject", short, value_parser = parse_inject_var_map)]
#[arg(long = "inject", short = 'i', value_parser = parse_inject_var_map)]
inject_vars: Option<HashMap<String, String>>,
/// Preserve the new updates. Only meaningful if used with inject.
@@ -212,6 +212,10 @@ pub enum ActionWithServer {
EngineOverride {
/// Configuration in JSON format
config_json: String,
/// Weather to print the current engine settings
#[arg(long = "sprint", short = 'p')]
print: bool,
},
}
@@ -344,9 +348,10 @@ impl ActionWithServer {
ActionWithServer::ShowDebug => {
return with_response_channel(app::DaemonCommand::PrintDebug)
}
ActionWithServer::EngineOverride { config_json } => {
ActionWithServer::EngineOverride { config_json, print } => {
return with_response_channel(|sender| app::DaemonCommand::EngineOverride {
config: config_json,
print,
sender,
})
}