chorus_cmd: fetch_by_id

This commit is contained in:
Mike Dilger 2025-02-10 06:57:08 +13:00
parent 685fa91296
commit 95ee2a572a
No known key found for this signature in database
GPG Key ID: 47581A78D4329BA4

View File

@ -56,6 +56,17 @@ fn main() -> Result<(), Error> {
}
println!("Done.");
}
"fetch_by_id" => {
let idstr = args
.next()
.ok_or::<Error>(ChorusError::General("ID argument missing".to_owned()).into())?;
let id: Id = Id::read_hex(idstr.as_bytes())?;
if let Some(event) = store.get_event_by_id(id)? {
println!("{event}");
} else {
println!("Not found.");
}
}
_ => {
return Err(ChorusError::General("Unknown command.".to_owned()).into());
}