h
This commit is contained in:
parent
03e229c38c
commit
e0887a62f1
2 changed files with 6 additions and 3 deletions
|
@ -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());
|
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
|
// single obj
|
||||||
let mut val = serde_json::from_str::<Value>("{}").unwrap();
|
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| {
|
its.iter().for_each(|item| {
|
||||||
value.insert(item.name.clone(), serde_json::to_value(&item.item).unwrap());
|
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(());
|
return Err(());
|
||||||
}
|
}
|
||||||
|
|
|
@ -134,7 +134,7 @@ impl<'rofi> Mode<'rofi> {
|
||||||
pub fn print_items(&self) {
|
pub fn print_items(&self) {
|
||||||
if self.output_singleobj {
|
if self.output_singleobj {
|
||||||
let mut val = serde_json::from_str::<Value>("{}").unwrap();
|
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| {
|
self.items.iter().for_each(|item| {
|
||||||
value.insert(item.name.clone(), serde_json::to_value(&item.item).unwrap());
|
value.insert(item.name.clone(), serde_json::to_value(&item.item).unwrap());
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue