Simplify error handling in cli module

This commit is contained in:
Joscha 2022-01-14 21:26:18 +01:00
parent 371c86f10f
commit 82affe39a1
7 changed files with 72 additions and 67 deletions

View file

@ -74,13 +74,13 @@ fn show_log(files: &Files, log: Sourced<'_, Log>) {
fn show_ident(files: &Files, entries: &[Entry], layout: &LineLayout, ident: Ident) {
match ident {
Ident::Number(n) => match layout.look_up_number::<()>(n) {
Ident::Number(n) => match layout.look_up_number(n) {
Ok(index) => show_entry(files, &entries[index]),
Err(e) => println!("{}", e),
},
Ident::Date(date) => match files.log(date) {
Some(log) => show_log(files, log),
None => println!("{}", Error::NoSuchLog::<()>(date)),
None => println!("{}", Error::NoSuchLog(date)),
},
}
}