requested changes

This commit is contained in:
Drew Tada 2024-01-23 17:15:39 -05:00
parent 9caa82c792
commit d21f77b243
2 changed files with 15 additions and 9 deletions

View File

@ -1,6 +1,7 @@
use kinode_process_lib::{
await_next_request_body, call_init, println, Address, ProcessId, Request,
};
use serde::{Deserialize, Serialize};
use serde_json::json;
wit_bindgen::generate!({
@ -11,6 +12,12 @@ wit_bindgen::generate!({
},
});
#[derive(Serialize, Deserialize)]
struct EditAliases {
alias: String,
process: Option<ProcessId>,
}
call_init!(init);
fn init(_our: Address) {
@ -31,9 +38,9 @@ fn init(_our: Address) {
let _ = Request::new()
.target(("our", "terminal", "terminal", "sys"))
.body(
json!({
"alias": alias,
"process": null
json!(EditAliases {
alias: alias.to_string(),
process: None
})
.to_string()
.as_bytes()
@ -46,9 +53,9 @@ fn init(_our: Address) {
let _ = Request::new()
.target(("our", "terminal", "terminal", "sys"))
.body(
json!({
"alias": alias,
"process": process
json!(EditAliases {
alias: alias.to_string(),
process: Some(process)
})
.to_string()
.as_bytes()

View File

@ -112,9 +112,8 @@ impl Guest for Component {
.aliases
.insert(edit_aliases.alias.clone(), process.clone());
println!(
"terminal: alias {:?} set to {:?}",
edit_aliases.alias,
process.to_string()
"terminal: alias {} set to {}",
edit_aliases.alias, process
);
}
None => {