diff --git a/.gitignore b/.gitignore index f2e56d3..6cd6664 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ /target Cargo.lock target/ + +# stray build dir (not source) +/src/CUBELinux-build/ diff --git a/cubesys/src/notes.rs b/cubesys/src/notes.rs index 13cee15..69df585 100644 --- a/cubesys/src/notes.rs +++ b/cubesys/src/notes.rs @@ -486,6 +486,24 @@ pub fn note_command(store: &ConcurrentStore, line: &str) -> Result { + let mut parts = rest.split_whitespace(); + let cs = parts.next().unwrap_or(""); + let cat = parts.next().unwrap_or(""); + let coord = crate::commands::parse_coord(cs) + .ok_or_else(|| format!("bad coordinate '{cs}' (want C.Z.Y.X)"))?; + if cat.is_empty() { + return Err("note tag needs ".to_string()); + } + match store.get_record(&coord) { + Some((mut header, body)) => { + header.doc_type = Some(format!("{NOTE_DOC_TYPE}:{cat}")); + store.put_record(coord, &header, &body); + Ok(format!("note {} tagged {cat}", coord_str(coord))) + } + None => Ok(format!("note {} -> (no note)", coord_str(coord))), + } + } "show" => { let cs = rest.trim(); let coord = crate::commands::parse_coord(cs)