Implement edit()
This commit is contained in:
parent
ded011b5b6
commit
272243a125
1 changed files with 14 additions and 2 deletions
|
@ -10,6 +10,7 @@ extern crate libimagutil;
|
|||
|
||||
use std::process::exit;
|
||||
|
||||
use libimagrt::edit::Edit;
|
||||
use libimagrt::runtime::Runtime;
|
||||
use libimagnotes::note::Note;
|
||||
use libimagutil::trace::trace_error;
|
||||
|
@ -73,8 +74,19 @@ fn delete(rt: &Runtime) {
|
|||
.ok();
|
||||
}
|
||||
|
||||
fn edit(_: &Runtime) {
|
||||
unimplemented!()
|
||||
fn edit(rt: &Runtime) {
|
||||
let note = Note::retrieve(rt.store(), name_from_cli(rt, "edit"));
|
||||
if note.is_err() {
|
||||
trace_error(¬e.err().unwrap());
|
||||
warn!("Cannot edit nonexistent Note");
|
||||
} else {
|
||||
let mut note = note.unwrap();
|
||||
if let Err(e) = note.edit_content(rt) {
|
||||
trace_error(&e);
|
||||
warn!("Editing failed");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fn list(rt: &Runtime) {
|
||||
|
|
Loading…
Reference in a new issue