Rewrite edit_entry() to use Store::get()

This commit is contained in:
Matthias Beyer 2016-05-28 21:27:55 +02:00
parent 8caeb17729
commit bbad841a60

View file

@ -69,14 +69,19 @@ fn edit(rt: &Runtime) {
}
fn edit_entry(rt: &Runtime, name: String) -> bool {
let note = Note::retrieve(rt.store(), name);
if note.is_err() {
trace_error(&note.unwrap_err());
let mut note = match Note::get(rt.store(), name) {
Ok(Some(note)) => note,
Ok(None) => {
warn!("Cannot edit nonexistent Note");
return false
}
},
Err(e) => {
trace_error(&e);
warn!("Cannot edit nonexistent Note");
return false
},
};
let mut note = note.unwrap();
if let Err(e) = note.edit_content(rt) {
trace_error(&e);
warn!("Editing failed");