This commit is contained in:
davidontop 2024-05-01 18:18:55 +02:00
parent 03e229c38c
commit e0887a62f1
Signed by: DavidOnTop
GPG key ID: 5D05538A45D5149F
2 changed files with 6 additions and 3 deletions

View file

@ -89,11 +89,14 @@ impl<'rofi> rofi_mode::Mode<'rofi> for Mode<'rofi> {
eprintln!("Example input:\n{}\n\nOutput is the same with changed value keys\nKeys with value of null can be omited\n\n", serde_json::to_string(&its).unwrap());
// single obj
let mut val = serde_json::from_str::<Value>("{}").unwrap();
let value = val.as_object_mut().unwrap();
let value = val.as_object_mut().unwrap();
its.iter().for_each(|item| {
value.insert(item.name.clone(), serde_json::to_value(&item.item).unwrap());
});
eprintln!("Example when using --edit-singleobj\n\n {}", serde_json::to_string(&val).unwrap());
eprintln!(
"Example when using --edit-singleobj\n\n {}",
serde_json::to_string(&val).unwrap()
);
return Err(());
}

View file

@ -134,7 +134,7 @@ impl<'rofi> Mode<'rofi> {
pub fn print_items(&self) {
if self.output_singleobj {
let mut val = serde_json::from_str::<Value>("{}").unwrap();
let value = val.as_object_mut().unwrap();
let value = val.as_object_mut().unwrap();
self.items.iter().for_each(|item| {
value.insert(item.name.clone(), serde_json::to_value(&item.item).unwrap());
});